Skip to main content
From start I branch yes/no based on a custom linerule. This code seems to not be working.

I'm able to bring up my starting aspx and submit it. I see the Instance with an error status. When I look at the ViewFlow I see nothing. So I'm assuming it's the linerules.

Below is the code -- I hope this is clear. I'm just posting the 'NO' side. The 'YES' side is very similar.

Public Sub Main1(ByRef K2 As LineRuleContext)

K2.LineRule = False
If (Func1(K2) = True) Then
K2.LineRule = True
Else
K2.LineRule = False
End If
End Sub

Private Function Func1(ByRef K2 As LineRuleContext) as Boolean

Func1 = False

Dim oneVariable As Object
Dim twoVariable As Object
Dim threeVariable As Object
Dim fourVariable As Object
Dim fiveVariable As Object
Dim sixVariable As Object
Dim sevenVariable As Object
Dim eightVariable As Object
Dim nineVariable As Object
Dim tenVariable As Object
Dim chkVariable As Object

oneVariable = K2.ProcessInstance.DataFields("CompEquipItemLocation1").Value
twoVariable = K2.ProcessInstance.DataFields("CompEquipItemLocation2").Value
threeVariable = K2.ProcessInstance.DataFields("CompEquipItemLocation3").Value
fourVariable = K2.ProcessInstance.DataFields("CompEquipItemLocation4").Value
fiveVariable = K2.ProcessInstance.DataFields("CompEquipItemLocation5").Value
sixVariable = K2.ProcessInstance.DataFields("K2DisposeCompEquip1").Value
sevenVariable = K2.ProcessInstance.DataFields("K2DisposeCompEquip2").Value
eightVariable = K2.ProcessInstance.DataFields("K2DisposeCompEquip3").Value
nineVariable = K2.ProcessInstance.DataFields("K2DisposeCompEquip4").Value
tenVariable = K2.ProcessInstance.DataFields("K2DisposeCompEquip5").Value
chkVariable = K2.ProcessInstance.DataFields("K2DisposeCompEquip").value

If len(oneVariable.ToString.Length) > 0 Then
Return False
ElseIf len(twoVariable.ToString.Length) > 0 Then
Return False
ElseIf len(threeVariable.ToString.Length) > 0 Then
Return False
ElseIf len(fourVariable.ToString.Length) > 0 Then
Return False
ElseIf len(fiveVariable.ToString.Length) > 0 Then
Return False
ElseIf sixVariable.ToString.ToUpper = "TRUE" Then
Return False
ElseIf sevenVariable.ToString.ToUpper = "TRUE" Then
Return False
ElseIf eightVariable.ToString.ToUpper = "TRUE" Then
Return False
ElseIf nineVariable.ToString.ToUpper = "TRUE" Then
Return False
ElseIf tenVariable.ToString.ToUpper = "TRUE" Then
Return False
ElseIf chkVariable.ToString.ToUpper = "TRUE" Then
Return False
Else
Return True
End If
End Function
The Linerule code looks fine. What is the error you're getting - Have a look in K2.net Service Manager and define a new Error Profile.

Regards,
Ockert
thanks,

I bet you get tired saying Create An Error Profile. Forgot that part of the class I suppose....

It was because I renamed the Public Sub to Main1. I thought that I couldn't have 2 Public Sub Mains -- so I changed the name. Once I put it back it worked.

Now I have some logic problems with the code. I expect it's because the data coming from the ASPX doesn't have the information I expect. In other words -- when I don't enter a field on my ASPX I was assuming it to be blank. I'm not checking for NULL. So off I go --- I'm getting closer.

thanks ---

Reply