Storage system queryItems behavior

Storage system queryItems behavior

ozawa_shinya
Advocate Advocate
986 Views
9 Replies
Message 1 of 10

Storage system queryItems behavior

ozawa_shinya
Advocate
Advocate

[ FlexSim 24.1.0 ]

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

0 Likes
Accepted solutions (1)
987 Views
9 Replies
Replies (9)
Message 2 of 10

moehlmann_fe
Collaborator
Collaborator
Accepted solution

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

Question about Storage.system.queryItems - FlexSim Community

0 Likes
Message 3 of 10

ozawa_shinya
Advocate
Advocate

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
Message 4 of 10

moehlmann_fe
Collaborator
Collaborator

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
Message 5 of 10

ozawa_shinya
Advocate
Advocate

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
Message 6 of 10

jason_lightfoot_adsk
Autodesk
Autodesk
I can't find, it so I'll add a new issue - thanks to you both!
0 Likes
Message 7 of 10

ozawa_shinya
Advocate
Advocate
Thank you very much.
0 Likes
Message 8 of 10

Jeanette_Fullmer
Community Manager
Community Manager

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
Message 9 of 10

lhermant
Explorer
Explorer

Hi,

I encountered the very same issue described here on a large scale model. I have a lot of very complex queries in this model. This issues makes it really hard to make sure everything works as expected. I discovered the fix by testing a manuel query to check that my activities FindItem were performing as expected.

Is is a very disturbing issue that makes me doubt that flexsim queries are performing as expected.

Could it be possible to fix this issue please ?

0 Likes
Message 10 of 10

Jacob_White
Community Manager
Community Manager
Hi @Lucas Hermant,

This issue has been reported to the Developer team and will be resolved as soon as possible.