iLogic Arraylist acting strange

iLogic Arraylist acting strange

meck
Collaborator Collaborator
2,044 Views
6 Replies
Message 1 of 7

iLogic Arraylist acting strange

meck
Collaborator
Collaborator

I have a simple multivalue list variable, but when I try to get the data from the list it loops through the first text in the list return each letter in the word. Example: If the first text in the multivalue list variable is "Hello" when looping through the list I get "H' then "e" then "l" ... and it never goes to the second item in the list.

 

Here is the simple loop right from standard sinppets..

 

For Each oval in MyVariableHere
MsgBox(oval)
Next

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
0 Likes
Accepted solutions (1)
2,045 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable

Could you post a sample part where this is happening? I can't replicate it in my 2013..

 

Tom

0 Likes
Message 3 of 7

meck
Collaborator
Collaborator

It's not a part it is a Inventor .dwg. It does it in the standard .dwg that comes with Inventor.

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
0 Likes
Message 4 of 7

MegaJerk
Collaborator
Collaborator

Could you post the code (and the parameters needed to run it)? 




If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
0 Likes
Message 5 of 7

meck
Collaborator
Collaborator

Below is the code. sText is a multi-value parameter. Attached is an example. Regenerate the rule "Test".

 

For Each oval in sText

    MsgBox(oval)

Next

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
0 Likes
Message 6 of 7

Anonymous
Not applicable
Accepted solution

Ah, OK I see what is happening.

 

The variable your using in the For Each loop (sText) is returning the current String value for that parameter, not a list. (and looping through a string will return each character)

 

Instead of 'sText' you need to pass in the 'List' of values - replace :

For Each oval in sText

with

For Each oval in MultiValue.List("sText")

Hope that helps,

Tom

0 Likes
Message 7 of 7

meck
Collaborator
Collaborator

That was easy. Thanks!

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
0 Likes