question

Cameron Pluim avatar image
3 Likes"
Cameron Pluim asked Cameron Pluim commented

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

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:

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

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?

FlexSim 16.0.1
process flowlabelsquerylists
works.jpg (81.9 KiB)
doesntwork.jpg (84.8 KiB)
· 8
5 |100000

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

Phil BoBo avatar image Phil BoBo ♦♦ commented ·

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

1 Like 1 ·
Cameron Pluim avatar image Cameron Pluim Phil BoBo ♦♦ commented ·

the first query also works if it is

 WHERE Equipment = "Tugger1" AND Length < getlabel(current,"AvailableLength")
0 Likes 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ Cameron Pluim commented ·

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

2 Likes 2 ·
903-doesntwork.jpg (86.4 KiB)
Show more comments
Cameron Pluim avatar image Cameron Pluim commented ·

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 0 ·
pulldoesntwork.fsm (49.0 KiB)
pullworks.fsm (49.0 KiB)
Jeff Nordgren avatar image Jeff Nordgren Cameron Pluim commented ·

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

0 Likes 0 ·
Cameron Pluim avatar image Cameron Pluim Jeff Nordgren commented ·

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 0 ·

1 Answer

·
Phil BoBo avatar image
9 Likes"
Phil BoBo answered Cameron Pluim edited

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.

· 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.

anthony.johnson avatar image anthony.johnson ♦♦ commented ·

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.

5 Likes 5 ·
Cameron Pluim avatar image Cameron Pluim commented ·

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

Thanks!

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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