clone column in a table

clone column in a table

marc_r5
Not applicable
59 Views
1 Reply
Message 1 of 2

clone column in a table

marc_r5
Not applicable

[ FlexSim 22.0.2 ]

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,

0 Likes
Accepted solutions (1)
60 Views
1 Reply
Reply (1)
Message 2 of 2

iago_mf
Not applicable
Accepted solution

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]");