question

Marc R5 avatar image
0 Likes"
Marc R5 asked Iago MF answered

clone column in a table

Hello,

I am creating a custom code where I need to clone just an existing column into a new column, mantaining both for ordering. I cannot see any command that allow me to do this, not clone, clone to, addcol, etc.

Any thoughts?

Best regards,

FlexSim 22.0.2
custom codecolumnclone
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

Iago MF avatar image
1 Like"
Iago MF answered Marc R5 commented

Hi Marc,

You can use .addCol() and then a loop to clone values for all rows. You can also copy all values using a Table.query like this: Table.query("UPDATE GlobalTable1 SET [Col 4] = [Col 2]").

For example:

Table temp = Table("GlobalTable1");

temp.addCol();

temp.setColHeader(temp.numCols, "Col 4");

Table.query("UPDATE GlobalTable1 SET [Col 4] = [Col 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.