Two Multivalue Lists, Second One Identical to First EXCEPT Selection in List 1?

Two Multivalue Lists, Second One Identical to First EXCEPT Selection in List 1?

-CraigZ-
Enthusiast Enthusiast
344 Views
4 Replies
Message 1 of 5

Two Multivalue Lists, Second One Identical to First EXCEPT Selection in List 1?

-CraigZ-
Enthusiast
Enthusiast

Running Inventor Pro 2019 and Vault Workgroup 2019 (no service packs yet).

 

I have some iLogic rules made to create multivalue lists in a part file. Is there a way I can make a second multivalue list that's identical to the first one EXCEPT the value from list 1 is removed?

 

For example, List 1 has A,B and C in the multivalue list. If I select A, then List 2 only has B and C in the multivalue list?

 

I need to do something similar to this, except the list has about 100 items in it.

 

Thanks!

 

 

0 Likes
345 Views
4 Replies
Replies (4)
Message 2 of 5

chandra.shekar.g
Autodesk Support
Autodesk Support

@-CraigZ-,

 

Try below iLogic code to update List_B on selection of List_A. It means that List_B is regenerated with new multi value list.

If List_A = "A" Then
	MultiValue.SetList("List_B", "B", "C")
 	List_B = "B"
Else If List_A = "B" Then
	MultiValue.SetList("List_B", "A", "C")
 	List_B = "A"
Else If List_A = "C" Then
	MultiValue.SetList("List_B", "A", "B")
 	List_B = "A"
End If

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 5

-CraigZ-
Enthusiast
Enthusiast
I totally would do this if it was a short list, however the list is every wide flange beam size from 4" to 40", so there are well over 100 sizes in there.

I did make the original multivalue list in iLogic with the multivalue.setlist code (even though I'm sure I could have done it a better way probably through excel, but I'm still fairly new to this and haven't got into excel stuff yet) but if there's 150 beam sizes in there, I'd need to make 150 different lines of multivalue.setlist commands to do it that way. Was hoping there would be a better way to just say "fill list 2 with the same values as list 1, except don't include the selected value in list 1"

I might be thinking about this the wrong way too. I'm considering simplifying the selections by just making it do something different if the user selects the same value in both list 1 and 2.

0 Likes
Message 4 of 5

lmc.engineering
Advocate
Advocate

Hi,

 

Here you go.

 

Version:1.0 StartHTML:00000145 EndHTML:00003065 StartFragment:00000294 EndFragment:00003033 StartSelection:00000294 EndSelection:00000294SyntaxEditor Code Snippet
'''Define two arrays. One to hold multivalue parameter list, one to hold new parameter list
Dim ListA As New ArrayList
Dim ListB As New ArrayList
'''Define working values
myValues = MultiValue.List("List_A")
''Set a parameter to equal current value in multivalue list
ListAVal = List_A
i = 0
'''Loop through each item in multivalue parameter
For Each Value In myValues
	ListA.Add(Value)
	x = ListA(i)
	'''If list value equals current multivalue, then skip it, otherwise add value to new arraylist
	If Not x = ListAVal Then ListB.Add(x)
i+=1
Next Value
'''Asign new arraylist to second multivalue parameter
MultiValue.List("List_B") = ListB

 

0 Likes
Message 5 of 5

-CraigZ-
Enthusiast
Enthusiast

@lmc.engineering

 

Will give this a try next week and mark it as accepted if it works for my situation. Currently have found a way around it (the way I mentioned at the end of my last post), but this would be good knowledge for me in the future!

 

Thanks,

0 Likes