Creating Ilogic table

Creating Ilogic table

jsteinkeATFRB
Observer Observer
294 Views
3 Replies
Message 1 of 4

Creating Ilogic table

jsteinkeATFRB
Observer
Observer

I created a table in a template and it works great, no problems at all. See code below

InitializeTable()
    
    Dim row As TableValues
    Dim found As Boolean = table.TryGetValue(SPEED+","+HWY_HEIGHT+","+GROSS_LOAD, row)
    If (found) Then 
        
        PART_SELECT= row.AY
		MAIN_SPRING= row.TV
	End If
Public table As New Dictionary(Of String, TableValues)

Sub InitializeTable

    table("600,0-350,6500-6999") = New TableValues("C42933001", 186)
    table("600,0-350,7000-7499") = New TableValues("C42933001", 183)
End Sub
Class TableValues
    
    Public AY As String
    Public TV As String
    
    Public Sub New(AY As String, TV As Double)
    
        Me.AY = AY
		Me.TV = TV
        
    End Sub
End Class
Now I am making another template and using the same code except
I am adding 2 extra columns. When I run the rule I get an error message.
Rest of the code is the same and I do not know what I need to fix to make it work. What is the solution to this

jsteinkeATFRB_0-1659558423228.png

Dim found As Boolean=table.TryGetValue(SPEED+","+HWY_HEIGHT+","+GROSS_LOAD+","+GOV_POSITION+","+MACHINE_TYPE, row)

table("200,0-350,7000-7499,Left,Geared" ) = New TableValues("C42932001", 193)

 

0 Likes
295 Views
3 Replies
Replies (3)
Message 2 of 4

Michael.Navara
Advisor
Advisor

For concatenation of strings use '&' instead of '+'. Or better solution is to use String.Join method

0 Likes
Message 3 of 4

jsteinkeATFRB
Observer
Observer

So I did switch the plus for the & and it fixed the error message but now something is broken, when I change a parameter my output (main spring) does not change, the change isn't recognized. I haven't tried the String.join yet I am not sure how if will affect the rest of the code.

0 Likes
Message 4 of 4

Michael.Navara
Advisor
Advisor

This looks like a iLogic Parameters Hell.

You can try to add some logging and look when the rule is executed. My expectation is the rule is NOT executed after parameter change.

If I'm right, you can try to fix it. Assign parameter value to variable. Like the following example for SPEED

 

Dim speedValue = SPEED

 

 

 

0 Likes