AX4.0 Traversing a grid on a form from within a method (english post)


I have a simple form with just a single table as datasource.

I have 2 hour-fields in the table (setup and process)

in the modified method on these fields (under datasource on the form) i need to add up all the hours in all the lines in the grid.

I have tried a while select on the datasource, but this only zero-sets what i just entered (i.e. data has NOT been transferred to the table at this time, and the while select statement apparently updates the grid from the table).

I also tried a while select Xtable_ds (_ds for datasource) but it won’t even compile this - it says Xtable_ds doesn’t exist.

Can anyone please explain to me how to traverse the grid in an non-invasive way ? (without changing data or focus in the grid)

Kind regards


You can use this display method on your form.

display real calcTimeTotal()
Xtable _xTable;

//looping the datasource

for (_xTable = xTable_ds.getFirst(); _xTable; _xTable = xTable_ds.getNext())
timeTotal += _xTable.timeField;
return timeTotal;

Best regards

Tam Vuong

Great !

Thank you !