question

Emmanuel VS avatar image
0 Likes"
Emmanuel VS asked Emmanuel VS commented

"Group by" field - Batch activity

Hello everyone,

I have a question regarding the "batch" activity. Is it possible to include more than one join criteria ("Group By" field)? I'm thinking in two or more labels.

I look forward to your response, thanks in advance.


1679414259530.png


FlexSim 21.0.10
proces flowgroup bybatch activity
1679414259530.png (16.0 KiB)
· 2
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 Jason Lightfoot ♦ commented ·
Please give an example with example labels and how they would aggregate.
0 Likes 0 ·
Emmanuel VS avatar image Emmanuel VS Jason Lightfoot ♦ commented ·

Hello @Jason Lightfoot

I attach a simple model where there are 2 labels (testA and testB), where each one can have two possible values (1 or 2).

Is it possible for the "Group by" field to consider both labels? For this example, this would define four possible batch IDs:

(testA, testB) : (1,1), (1,2), (2,1), (2,2).

Groupby-batch.fsm


0 Likes 0 ·
groupby-batch.fsm (28.3 KiB)
Jordan Johnson avatar image
1 Like"
Jordan Johnson answered Emmanuel VS commented

You can use an Array:
1679929687763.png

When you enter the Array, you'll get an exception that says "Arrays are not valid in this field". However, this is a UI-level exception. The array actually works just fine. I'll add an issue to the dev list to remove that check.


1679929687763.png (6.0 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.

Emmanuel VS avatar image Emmanuel VS commented ·
I tried this option and it works correctly. Great solution!.


Than you very much for answering.


0 Likes 0 ·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Emmanuel VS commented

In your given example, you would have to join the two labels into a single, unique value in some way.

One example would be to simply connect them together as strings, which will work for arbitrary values.

string.fromNum(token.testA) + string.fromNum(token.testB)

If you know that the numbers are integers and will always fall into a certain range, you can also combine them into a unique number by shifting the decimal point of one of the labels by a sufficiently large margin.

token.testA*10 + token.testB

groupby-batch_1.fsm


groupby-batch-1.fsm (28.6 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.

Emmanuel VS avatar image Emmanuel VS commented ·
Hi @Felix Möhlmann

The idea you mention is a great alternative solution.

Than you very much for answering.

0 Likes 0 ·