question

Xu Chunqi avatar image
0 Likes"
Xu Chunqi asked Xu Chunqi commented

query slot by classtype of storageObject

Hi

I want to query slot by classtype of storageobject. How to write the query sentence?

The usual query sentence is "Variant slots = Storage.system.querySlots("WHERE slot.levelID = "+level_id,0);"

Thank you.

FlexSim 20.1.3
flexsim 20.1.3query slot
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

@xu.chunqi, can you be a bit more precise what you want to achieve? What is level_id? - A label, a previous level. Do you want to get as a result an array of slots ordered in a special design? Thanks!

0 Likes 0 ·
Xu Chunqi avatar image Xu Chunqi Joerg Vogel commented ·

In my model, there are two classes of rack , one is Rack, the other is FloorStorage.

When I choose slot to store items, I want choose FloorStorage.

I want to use querySlots to find slot, but I donnot know how to write the query sentence.

0 Likes 0 ·

1 Answer

·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered Xu Chunqi commented

I suggest you choose the rack by name:

Variant slots = Storage.system.querySlots("WHERE slot.storageObject.name = 'FloorStorage1'",0);

or pointer

Variant slots = Storage.system.querySlots("WHERE slot.storageObject = $1",0,Model.find("FloorStorage1"));

or if you have more objects then with clause IN

Array myRacks = [Model.find("FloorStorage1")];
Variant slots = Storage.system.querySlots("WHERE slot.storageObject IN $1",0,myRacks);
· 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.

Xu Chunqi avatar image Xu Chunqi commented ·

Hi Joerg, thank you very much!

0 Likes 0 ·

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.