In global table I have control points, Max allocations and Deallocation type, I am trying using this global table how to update this in the model through code.
In global table I have control points, Max allocations and Deallocation type, I am trying using this global table how to update this in the model through code.
Thanks for your code. Could you please give feedback on understanding the code of yours for following questions
I'm trying to understand In Table.query command what is Gt1.ROW_Number. What this does actually.
And if(res.numRows<=0) continue; What is this code for ?
res.cloneTo(Table("GlobalTable2")); why are you cloning to Global Table2?
Object agvnetwork = Model.find("AGVNetwork"); treenode an_cPs= agvnetwork.find(">?controlPoints"); treenode an_daT= agvnetwork.find(">?deallocationTypes"); Table gt1 = Table("GlobalTable1"); for(int i = 1; i <= an_cPs.subnodes.length; i++) { Object cpi_obj = ownerobject(tonode(an_cPs.subnodes[i].value)); Table res = Table.query("select *,Gt1.ROW_NUMBER as RN from $1 as Gt1 WHERE [Col 1] = $2 ", gt1, cpi_obj.name); if(res.numRows <= 0) continue; res.cloneTo(Table("GlobalTable2")); treenode maxAllocations = cpi_obj.find(">?maxAllocations"); treenode deallocationTypeRank = cpi_obj.find(">?deallocationTypeRank"); int gt1Row = res[1]["RN"]; cpi_obj.find(">?maxAllocations").value = gt1[gt1Row][2].as(string).toNum(); cpi_obj.find(">?deallocationTypeRank").value = an_daT.subnodes[gt1[gt1Row][3]].rank; }
I'm trying to understand In Table.query command what is Gt1.ROW_Number. What this does actually.
Q1:Get the original row of global table 1
And if(res.numRows<=0) continue; What is this code for ?
Q2:Prevent you from filling in an incorrect CP name
res.cloneTo(Table("GlobalTable2")); why are you cloning to Global Table2?
Q3:It‘s for test,You can comment on the code
You defined gt1 as variable but in Table Query you are using it as Gt1 so got confused. Is both are different or same
Table gt1 = Table("GlobalTable1");
Table res = Table.query("select *,Gt1.ROW_NUMBER as RN from $1 as Gt1 WHERE [Col 1] = $2 ", gt1, cpi_obj.name);
14 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