question

Scott Ainsworth avatar image
0 Likes"
Scott Ainsworth asked Matthew Gillespie commented

Why does my integer variable not set from label?

I'm trying to process some tokens by case with a switch command that requires an integer.

I have some custom code that looks up a WType string in a table and assigns an WTypeVal label to the tokens. I want to use WTypeVal in the switch command. However, I seem to only get 0 assigned to the integer variable Wtype. I've tried a dozen variations with the same result. I've posted a pic of the model. It is difficult to post the whole model as there is client proprietary info in it.

As you can see the custom code is in a subprocess. The token in question has WTypeVal of 3. I only get Wtype of 0. I assigned 15 to Wtype just to prove it changes to 0.

It seems that Parent, Child relationship is a bit fuzzy going to a subprocess with custom code because many of the Label names do not show up in the pick list when entering code.

Any help is appreciated.

wtype-not-set.jpg

Scott

FlexSim 18.2.2
process flowlabelscoding
wtype-not-set.jpg (135.1 KiB)
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Raja Sekaran avatar image
1 Like"
Raja Sekaran answered Matthew Gillespie commented

@Scott Ainsworth

Since you are saying like "I have some custom code that looks up a WType string in a table and assigns a WTypeVal label to the tokens."

Make sure that you are getting the number type as a value in the label. If you are getting a label value as string type then you have to convert that into number type using toNum() or stringtonum() command.

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.