AnswerHub Upload Issue
Our AnswerHub community currently has a bug that prevents you from attaching your model or other files to your questions. AnswerHub is aware of this issue and they are working on a fix. Until we receive their patch, you can upload your models and other files to FlexSim's file share site. Include the file name in your question so that we know which upload to reference.

question

Yokota T avatar image
0 Likes"
Yokota T asked Yokota T commented

"ORDER BY Distance" query does not work in "Find Slot"

Hello, all.

In the property of Find Slot activity, I set the query to "ORDER BY/ Distance from Object."

However, when I ran the simulation, an exception occurred. The message is as follows.

time: 10.859958 exception: SQL Evaluation Exception: FlexScript exception thrown in evaluation of code. Code is: ((param(1).as(Storage.Slot).location.project(param(2).as(Storage.Slot).storageObject,model())) - (param(3).as(Object).location.project(param(4).up,model()))).magnitude. Forwarding throw.
time: 10.859958 exception: SqlQuery - FlexScript Exception in: ORDER BY (slot.location.project(slot.storageObject, model()) - $1.as(Object).location.project($1.up, model())).magnitude ASC


I think it is because the query assumes that $1 contains token.item, but the default $1 contains token.

Thank you.


FlexSim 22.2.0
queryfind slot
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

·
Kavika F avatar image
0 Likes"
Kavika F answered Yokota T commented

Hey @Yokota T, it's true that in the sorting algorithm,

ORDER BY (slot.location.project(slot.storageObject, model()) - $1.as(Object).location.project($1.up, model())).magnitude ASC

the $1 is assumed to be something that can be interpreted as an Object (hence the ".as(Object)"). Although the $1 parameter defaults to token, you can change it to be whatever you'd like. In the picklist next to the $1 parameter, you can click on Token >> item to change it.

1659730806718.png

You can use any of these possibilities; however, it's up to the person building the model to know what to put there. Flexsim was built trying to avoid making any assumptions about what the user may want to put. We just try to provide a framework for you to build models effectively :)


1659730806718.png (79.6 KiB)
· 1
5 |100000

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

@Kavika F , Thank you for your response. That makes sense. This notation is easier to change if the label name is other than "item."

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.