question

Enrique Elizaga avatar image
0 Likes"
Enrique Elizaga asked Enrique Elizaga commented

How to pull using array label?

Hi, I tried to pull tokens that comply with either of 2 label criteria.

One SKU_SOURCE is a regular label match operation and the other one SKU_MULTISOURCE an array that is relevant if its index value is greater than 0. Both labels are delcared in the list.

I tried:

WHERE SKU_SOURCE == Puller.SOURCE, OR SKU_MULTISOURCE[index] > 0

It didn't work. Any ideas?

FlexSim 18.0.0
pull from listarray label
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

·
Mischa Spelt avatar image
0 Likes"
Mischa Spelt answered Enrique Elizaga commented

Hi Enrique. First of all, what you posted has a syntax error: there should not be a comma before OR:

WHERE SKU_SOURCE == Puller.SOURCE OR SKU_MULTISOURCE[index] > 0

Maybe that already solves your problem. If not, the parser probably does not understand the array index notation. Is index a label on the pulled tokens as well? In that case, you could create a label for SKU_MULTISOURCE[index] and just use that in your query. Or, the workaround that sort of pollutes your toolbox but always works: create a user command MatchesSource taking two tokens, that returns true or false:

Token puller = param(1);
Token pulled = param(2);
return pulled.SKU_SOURCE == puller.SOURCE || pulled.SKU_MULTISOURCE[pulled.index] > 0;

and then in your query you can simply write:

WHERE MatchesSource(puller, value)
· 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.

Enrique Elizaga avatar image Enrique Elizaga commented ·

Hi @Mischa Spelt in version 2018, when you use a WHERE statement in process flow with more than one argument from the pull list it automatically places a comma. Who can I report this to?

On the other hand I tested the pull from list using the standard array notation LABEL[index] and it did worked perfectly. It was the unwanted

comma.

0 Likes 0 ·
capture.png (18.4 KiB)

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.