Quantcast
Channel: From the Trenches with Autodesk Inventor
Viewing all articles
Browse latest Browse all 61

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

$
0
0
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)

DimB_ListAsNewArrayList
B_List=MultiValue.List("List_B")

DimC_ListAsNewArrayList
C_List=MultiValue.List("List_C")

DimTemp_ListAsNewArrayList

Temp_List.Clear
ForEachoIteminB_List
IfList_A>=oItemThen
Temp_List.Add(oItem)
EndIf
Next

MultiValue.List("List_B")=Temp_List

Temp_List.Clear
ForEachoIteminC_List
IfList_A>=oItemThen
Temp_List.Add(oItem)
EndIf
Next

MultiValue.List("List_C")=Temp_List


Viewing all articles
Browse latest Browse all 61

Trending Articles