Monday, May 10, 2010

Refresh All Datasource inside a form

Counter i;
Common currentRecord;

;

For (i=1; i<=Element.dataSourceCount(); i++)
{
currentRecord = Element.dataSource(i).cursor().data();
// Don't lost the Filter or Range Condition
Element.dataSource(i).research();
Element.dataSource(i).refresh();
Element.dataSource(i).findRecord(currentRecord);
}

If the AX version is greater or equal AX 2009 the code become :

For (i=1; i<=Element.dataSourceCount(); i++)
{
currentRecord = Element.dataSource(i).cursor().data();
// Don't lost the Filter or Range Condition
Element.dataSource(i).research(TRUE);
Element.dataSource(i).refresh();
}

No comments: