question

Gesa R avatar image
0 Likes"
Gesa R asked Kari Payton commented

How to print or look up a local table in FlexScript in a ProcessFlow?

Hi,

I have a process flow in wich I use custom code. In the custom code I use a query to get specific data from two different global tables. Now I would like to check if the query is correct, e.g. print or view the new table "result". Where does this table "result" exist? I did not create a new global table for this.

Table result=Table.query("SELECT * FROM Workers AS A, Machines AS B WHERE A.MachineNo=B.MachineNo AND B.MachineNo=1);

The command print(result); shows <no path>.

Thank you for helping.

@Mischa Spelt

FlexSim 18.0.3
process flowflexscripttablesnodesprint
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

Matthew Gillespie avatar image
2 Likes"
Matthew Gillespie answered Kari Payton commented

You can use the cloneTo method to copy the in-memory result table to an actual table in the model.

result.cloneTo(Table("GlobalTable1"));

You can also use the clone method to copy the table into an array which could then be printed.

print(result.clone());
· 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.

Kari Payton avatar image Kari Payton commented ·

Is is possible to assign a label to a token from a query without cloning to a table? For example I want to lookup a value in table 1 column A that matches the value in table 2 column A and write to a label a value from table 2 that is in column F. @Matthew Gillespie

0 Likes 0 ·