Hi Team,
I am generating tokens and appending values to array. But array is not showing values as [1,2,3,.....].
Can you help to understand what is going wrong here?
ArrayLabelNot ShowingElements.fsm
Thank you!
Hi Team,
I am generating tokens and appending values to array. But array is not showing values as [1,2,3,.....].
Can you help to understand what is going wrong here?
ArrayLabelNot ShowingElements.fsm
Thank you!
'append()' adds an array to the end of another array. In your code, you are passing in a number though, which gets interpreted as an (empty) array with a length corresponding to the number.
Either pass in the number as an array of length one by enclosing it in [] brackets. Or use array.push instead, which is used to add values to the end of an array.
array.append([Counter]); array.push(Counter);
Hi @Felix Möhlmann,
Thanks for your answer but it is not working as I was expecting [1,2,3,4,5......................].
While pushing elements to array, array size is not increasing. It is only coming as 1 and showing the last pushed value.
It will be helpful if you can attach working model.
Thank you!
To get the effect you describe you need to assign the clone of a global array to the token using this :
Counter+=1; return counterArray.push(Counter).clone();
where counterArray is a global variable of the array type.
Thank you so much @Jason Lightfoot!
It is working same as I was expecting.
Still I have one question if I can. Why it is not working same (local array is only showing 1 element) with local array variable?
Thank you!
15 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved