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:

  1. 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:

  1. 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:

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

and then in your query you can simply write:

  1. 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.