question

Ashmita G avatar image
0 Likes"
Ashmita G asked Ashmita G commented

Integer values and label not recognized in the custom code

I am trying to collect some information in my model at the decision box.

I want to run a loop through the global table to identify the Queues corresponding to the "station" upon which the pallets arrive. I have used a label to identify the station the pallet arrives at. After that I run a loop to check all the rows for the same station value. And thereafter I need the label "curInv" to decide the path to be taken after the decision box. However, it seems the code fails to create the label curInv, and goes down the wrong path.

I tried to check if it was registering the integer values feeding the curInv label information, it seems the values are read as '0' from the global table there, despite having been assigned proper numeric values in the table.

Kindly advice.Doubt_Rep.fsm

FlexSim 20.1.1
labelsflexsim 20.1.1tokenscustom code
doubt-rep.fsm (45.8 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

Aida Chaikh avatar image
1 Like"
Aida Chaikh answered Ashmita G commented

Hi @Ashmita G,

In your model you have a table named "Restore Table" and this table has 3 columns (Total, Pkg and curInv) as string data and the table "Working Table" is a copy of this. But, in the activity Decide you get the values of the table and the variables f = Table("Working Table")[i][3] and k =Table("Working Table")[i][4] are integers. If you change the Restore Table and assign number data to this columns, the code works.

I hope it helps!


assign-data.png (23.6 KiB)
· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Ashmita G avatar image Ashmita G commented ·

Hi @Aida Chaikh thanks a ton for the prompt and helpful reply. Just a follow up, is there a way to know that the values had been defined as string? As in I wasn't able to tell that was the case, so wondering if there is a way to confirm that, like a query or a property to cross check with.

Thanks again!

0 Likes 0 ·
Aida Chaikh avatar image Aida Chaikh Ashmita G commented ·

Hi @Ashmita G. You can use the command treenode.dataType. In the User Manual there is a description:

https://docs.flexsim.com/en/21.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Tree/treenode.html#Property-dataType

1 Like 1 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Ashmita G commented ·

Strings are left justified while numeric data is right justified.

1 Like 1 ·
Ashmita G avatar image Ashmita G Jason Lightfoot ♦♦ commented ·

Thank you @jason.lightfoot

0 Likes 0 ·