question

Shinya O avatar image
0 Likes"
Shinya O asked Jeanette F commented

Storage system queryItems behavior

Hi,

The code below should return the number of all items in storage, but the behavior seems to change when "Find Item" query in the processing flow is executed with "Any Item".

return Storage.system.queryItems("").length;

In this model, initially 10 items enter Bay=1, at 10 seconds it searches for one item with Bay=1, and at 20 seconds it searches for one arbitrary item.

After that, When I run that code I expect it to return 8, but it returns 1.

Is my understanding correct?

Thanks in advance.queryItems.fsm

1717036012103.png

FlexSim 24.1.0
storage systemfinditemqueryitems
1717036012103.png (257.0 KiB)
queryitems.fsm (41.8 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.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Shinya O, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

Looks like the same issue described in the post linked below.

Question about Storage.system.queryItems - FlexSim Community

· 5
5 |100000

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

Shinya O avatar image Shinya O commented ·

Thank you for your information.

The following code replicates the issue without using the Find Item activity as you have mentioned.

Storage.system.queryItems("", Storage.QueryFlags.Limit1);
return Storage.system.queryItems("").length;


If an empty query string is bad, I would like to avoid them as follows until this bug is fixed.

Storage.system.queryItems(" ", Storage.QueryFlags.Limit1);
return Storage.system.queryItems("").length;
0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Shinya O commented ·

One of our clients actually encountered this issue recently and we concluded that this might be an issue with caching queries. It's not necessarily the empty query string that is the problem. Any query string that was previously used in findItem() (either in code directly or the Find Item activity) will return only a single slotItem.

queryitems_1.fsm

Your workaround of using a single space in the query will work, as long as this same string is never used in findItem(). (But there isn't really any reason to do so, so I don't expect any problems.)

Since you provided a solution to the problem, it would be good if you could convert your comment to an answer an accept it.

0 Likes 0 ·
queryitems-1.fsm (41.7 KiB)
Shinya O avatar image Shinya O Felix Möhlmann commented ·

This workaround is not practical for large scale models because there is no way to know which query strings have been cached. I would be grateful if there is a better way...


Hello @Jason Lightfoot , is this issue on the dev list?

0 Likes 0 ·
Show more comments

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.