Hello,
is there a command or a way to copy a whole row from one table into another table without using a loop?
Right now I am using a for-loop to get each column individually.
Thanks.
Hello,
is there a command or a way to copy a whole row from one table into another table without using a loop?
Right now I am using a for-loop to get each column individually.
Thanks.
Your table is build up with a node structure. Actually every row is a node with subnodes for the columns. So can can copy a row with the createcopy command.
@Anna Lisa Dierking It should look something like this:
treenode origTable = reftable("Table1"); treenode destTable = reftable("Table2"); int rowNo = x; //your rowno createcopy( rank( origTable, rowNo), rank(destTable, rowNo), 1, 0, 0, 1);
Thank you.
Can I do that even if the table row I want to copy is part of the result of a query()? Or do I have to copy the sql result into a temporary global table first?
yes this will only work if the table structure is build up out of nodes and the query is in memory so you have to transform it to a normal table first.
@steven.hamoen, Thanks. Could you give me an example on how to use the createcopy command to copy a specific row from one global table as a new row into another global table?
hi Steven, i want to do similar thing but I want to copy a specific column from table. How do i do that? please help.
@sachin T3 if you look at the tree structure you will see that copying a column means copying 1 particular node from each row so there is no easy way. You can either do as in the original post just use a for loop or (but I don't know exactly how and what you want to copy) you could also copy the whole table and then delete the columns you don't need (look at the Table class)
Hello @sachin T3,
You can easily copy a column. In the following I am copying it to another table.
Table.query("SELECT [Col 1] FROM [GlobalTable1]").cloneTo(Table("GlobalTable2"))
Can you show us your case - ideally in a new question? If the target table already has row values then an update clause on the target table with a join may be necessary.
19 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