000

iLogic - Dynamic MultiValue Parameter Lists "Filtered" By Current Selected Value

.
Issue:
You want to "filter" a list (List B) based on the selection from another list (List A), but the lists are long and writing the If/Then or Select Case statements are repetitive, and difficult to maintain. Is there a better way?

Solution:
You can use ArrayLists and For Each Statements to do this, as shown in this example.

Here an illogic form is used, and when a value is selected from List A, then List B and C are reset to include only values less than or equal to the current selected List A value.



Example file:
Dynamic MultiValue Lists iLogic 2015.ipt ‏68 KB    

SyntaxEditor Code Snippet
Example code:

'reset List B list to default
MultiValue.SetList("List_B", 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)

'reset List C list to default
MultiValue.SetList("List_C", 2,4,6,8,10,12,14,16)

Dim B_List As New ArrayList
B_List = MultiValue.List("List_B")

Dim C_List As New ArrayList
C_List = MultiValue.List("List_C")

Dim Temp_List As New ArrayList

Temp_List.Clear
For Each oItem in B_List
If List_A >= oItem Then
Temp_List.Add(oItem)
End If
Next

MultiValue.List("List_B") = Temp_List

Temp_List.Clear
For Each oItem in C_List
If List_A >= oItem Then
Temp_List.Add(oItem)
End If
Next

MultiValue.List("List_C") = Temp_List

Blog Archive