question

Nicolas Mbz avatar image
0 Likes"
Nicolas Mbz asked Nicolas Mbz commented

How to get the value of an array in a statistic collector ?

I would like to get the the value of a label named "Trajectoire" in a stats collector.

sc3.png


The column is set :

sc4.png


the table :

sc5.png

the value of the label is defined when the event of SC fires. But nothing in the column "Trajectoire", why ? Thanks in advance

FlexSim 22.1.0
statistic collectorarray
sc3.png (13.3 KiB)
sc4.png (36.1 KiB)
sc5.png (198.6 KiB)
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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Nicolas Mbz commented

An array is not a valid data type for a statistics collector column.

1661180610880.png

You could display the contents of the array as a single string by adding them together The code below would show them with " | " as a separator between the array entries.

Array trajecArr = data.token.Trajectoire;
if(trajecArr.length > 0) {
    string trajecStr = trajecArr[1];
    for(int i = 2; i <= trajecArr.length; i++) {
        trajecStr += " | " + trajecArr[i];
    }
    return trajecStr;
}
return "";

1661180873646.png

1661180886490.png


1661180610880.png (8.3 KiB)
1661180873646.png (1.3 KiB)
1661180886490.png (54.7 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.

Nicolas Mbz avatar image Nicolas Mbz commented ·
perfect thanks :)
0 Likes 0 ·