·
1 min read

Research method on X++ forms

In AX2009 if you call the research() method on a form passing true, the cursor position within a grid should be retained.  However, this is true only if the query created by the form uses inner joins.  Any outer joins, aggregations, temp tables, etc. cause the cursor to go to either the first or last record (depending upon the StartPosition property for that data source).  In 2009 if you want to keep the cursor position and use joins other than inner joins you have to keep track of the cursor position.  Code like the following will do this:

    int pos;

    super();

    pos = salesQuotationTable_ds.getPosition();
    salesQuotationTable_ds.research();
    salesQuotationTable_ds.setPosition(pos);