question

Tom avatar image
0 Likes"
Tom asked Tom answered

Problem in Custom Code using SQL which uses label on token in WHERE clause

Test_CountNumbersOfItemInSlot.fsm


I'm trying to get slot wise item/SKU count using Custom Code in Process Flow.

I've created and tried 3 patterns, "Get SlotWiseItemCount" 1 to 3 but all 3 has issues.

There are diffrence in location of "WHERE" clause but all 3 Custom Code has practically the same SQL but all results are different and incorrect.

Since SQL is having WHERE condition, LocationCD = token.LocationCD, only single row should come but as you could find in attached model, it wont.


Please take a look into Custom Code "Get SlotWiseItemCount" 1 to 3.

Checking will be easier if you use Global Table "QueryDump".

Kindly let me know whether I have done something wrong.


Thanks for the support.

FlexSim 23.0.8
sqlcustomcodequeries
· 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.

Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered Jason Lightfoot edited

You can get your table at any time directly from the storage system:

  1. Storage.system.querySlots("SELECT  slot.slotItems.length, slot.address").as(Array).as(Table).cloneTo("QueryDump")
· 3
5 |100000

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

Tom avatar image
0 Likes"
Tom answered

@Jason Lightfoot
Thanks, now its working.
So what I was missing was appropriate symbol.

Thanks for the support

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
0 Likes"
Joerg Vogel answered Joerg Vogel commented

If you want to get the content of a slot address, why do you try to do it so complicated.

  1. Variant slotitems = Storage.system.queryItems("WHERE item.slot.address = $1",0,token.LocationCD);
  2. token.labels.assert("inSlot",slotitems.length); 
· 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.