Hi All,
What is the best way to add datarow into to a datatable in app?
In the documentation, it is simply dt.addrow(row). The part I’m not sure about is to populate the row value.
In Studio, the add row activity allows arrayrow, is there something similar in Apps? The current solution I have make a copy of existing row and then update individual column values and finally add the new row to data table. this method is not very efficient, and I haven’t worked out what to do if the table is empty to begin with.
The quickest way I found is to create a temp table with the relevant value in an app variable
BuildDataTable(
New DataTable(“TempDT”),
New DataColumn(){ New DataColumn(“Name”), New DataColumn(“Age”)},
New List(Of Object) From {
AddDataRow(New Object(){“Baishali”, “30”}),
},
True
)
and then add the datarow to the existing table by
dt.addrow(TempDT.Select.First)
Still would be nice to just do dt.addrow() or dt.rows.add({arrayString}), but the above method works for now.