Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi Everyone,
So I would like to update a row in an InfoTable, but I couldn't find a snippet for it.
Basically, I would like to find my row first and then update an attribute of it and then push it back to InfoTable
like following:
var foundedRow = me.MyInfoTable.Find(myObject);
foundedRow.color = "blue";
me.MyInfoTable.UpdateRow(myObject,foundedRow)
MyInfoTable.myColumn=myNewValue;
Hi Mustafa,
To update an Infotable Property, you should never do it directly on the property, instead you should copy the Infotable Change it and set it again as a whole on the property ( see step 1 and 4 ):
1. var modified = me.MyInfoTable; // -- This creates a copy of the infotable not a reference
2. var row = modified.Find(myObject);
3. row.color = "Blue";
Can you explain why you should not modify the property directly? There is no real difference in copying the infotable except for the fact that you now have another (potentially large) object occupying memory.
Hi Wayne,
That's the recommended way by R&D. Some reasons:
Best Regards,
Carles.
Thanks Carles
But I am not sure if you actually forgot to add this 5th step, or we didnt need that
1. var modified = me.MyInfoTable; // -- This creates a copy of the infotable not a reference
2. var row = modified.Find(myObject);
3. row.color = "Blue";
4*. modified.addRow(row);
You don't need 4* step to modify the row value.
Okay cool, thanks Carles! This was helpful.