Can I query from a list using a value from a label?

Can I query from a list using a value from a label?

cameron_pluim
Not applicable
54 Views
11 Replies
Message 1 of 12

Can I query from a list using a value from a label?

cameron_pluim
Not applicable

[ FlexSim 16.0.1 ]

I have a tugger that is searching for objects that it can pick up, but it has to be able to fit on the tugger's train, and be scheduled to be picked up by that specific tugger. I assumed the following code would work:

903-doesntwork.jpg

It doesn't ever pull anything, but when I put in the values (instead of the FlexScript queries) it works e.g:

902-works.jpg

Note that current in the first section points to the tugger object that has the labels.

How can I reference these labels within the query? Do I need to put them on the token instead of on the object?

Accepted solutions (1)
55 Views
11 Replies
Replies (11)
Message 2 of 12

philboboADSK
Autodesk
Autodesk

Your first query seems to be missing a ) after "Equipment". Maybe that's why?



Phil BoBo
Sr. Manager, Software Development
Message 3 of 12

cameron_pluim
Not applicable

the first query also works if it is

 WHERE Equipment = "Tugger1" AND Length < getlabel(current,"AvailableLength")
0 Likes
Message 4 of 12

philboboADSK
Autodesk
Autodesk

Does it work if you change it from getlabel(current,"Equipment" to getlabel(current,"Equipment") ?

904-903-doesntwork.jpg



Phil BoBo
Sr. Manager, Software Development
Message 5 of 12

cameron_pluim
Not applicable

Since I currently only have 1 tugger in the model, I have taken that out completely, and just have:

WHERE Length < getlabel(current,"AvailableLength")

And this doesn't work, but

WHERE Length < 15

does work. So I don't think the typo on

getlabel(current,"Equipment"

missing a ) is the issue.

0 Likes
Message 6 of 12

philboboADSK
Autodesk
Autodesk

Can you post an example model so that we can debug what is happening?



Phil BoBo
Sr. Manager, Software Development
0 Likes
Message 7 of 12

cameron_pluim
Not applicable

Here's the 2 examples of each. The model doesn't work beyond the pull in either of them, but it does pull correctly in the example that doesn't use the getlabel() command. The only difference between these 2 is that the pull from list uses Length < 15 in the one that works, and Length < getlabel(current,"AvailableLength") in the one that doesn't work

pulldoesntwork.fsm

pullworks.fsm

0 Likes
Message 8 of 12

jeff_nordgren
Not applicable

Cameron, what if you set a Global Variable to getlabel(current,"AvailableLength") and then used that Global Variable in the Query?

0 Likes
Message 9 of 12

philboboADSK
Autodesk
Autodesk
Accepted solution

Looking into this, in the Query field, you don't have access to "current".

You only have access to "value" and "puller". In your case, puller is the entering token, so you would need to either change puller to the tugger, or get a reference via the token.



Phil BoBo
Sr. Manager, Software Development
Message 10 of 12

anthony_johnsonT83CM
Autodesk
Autodesk

Also, in list SQL, getlabel(puller, "labelName") is the same as puller.labelName, and getlabel(value, "labelName") is the same as value.labelName is the same as labelName.

Message 11 of 12

cameron_pluim
Not applicable

I was able to change puller to current, and then use puller.AvailableLength (as Anthony said above)

Thanks!

Message 12 of 12

cameron_pluim
Not applicable

Jeff, I could have set a Global Variable, but I would need a Global Variable for each instance of this Process Flow (maybe a Process Flow Variable would be better). I think the better solution (in order to keep the information on the tugger itself) is to change puller to be current (as stated by Phil), then I have access to the puller's labels.

0 Likes