web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

locate the current cursor of a table.

(0) ShareShare
ReportReport
Posted on by

Hello.

I am using QueryBuildDataSource.

How can I locate the current cursor, if I know what is the exact key (Using QueryBuildDataSource) ?

Thanks :)

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    QueryBuildDataSource is a query specification only, it doesn't fetch any data.

    If you are using QueryRun, you can obtain current record by calling get(yourTableId).

    If you are on a form, you can also use FormDataSource.cursor().

  • Community Member Profile Picture
    on at

    OK.

    There is a grid component (I don't know if it is global to Microsoft Dynamic AX.

    Specificaly on : GPaperLookup, GPaperTable init event. The packagingGrid component).

    How can I locate the cursor on the grid component?

    Thanks :)

  • Luegisdorf Profile Picture
    1,930 on at

    The cursor on the grid equals the cursor to the form data source which represents the data provider for the grid.

    Just take the name of the data source and add underscore & 'ds' to access the form data source. The cursor is retrieved by the method cursor().

    Example:

    myEmplTableBuffer = emplTable_ds.cursor();

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    I see that the question was probably answered, anyway I'll post my answer too, because the question may not to be actually about cursors at all. :-)

    GPaperLookup is not a standard form. I'll assume that packagingGrid is a FormGridControl. In that case, don't try to get value from the grid, use rather its underlaying data source. If it GPaperTable is the corresponding data source, you have two (basic) possibilities:

    For single-selection scenarios, get the value directly from GPaperTable variable.

    For multi-selections, the easiest way would be something like this:

    GPaperTable paperTable;
    MultiselectionHelper selection = new MultiselectionHelper();
    selection.parmDatasource(GPaperTable_ds);
    paperTable = selection.getFirst();
    while (paperTable)
    {
    //do something
    paperTable = selection.getNext();
    }
  • Community Member Profile Picture
    on at

    Found.

    This is a simple solution, that I could find at your answer this one.

    just put on "ExecuteQuery" method of datasource the lines :

    MyRefTable = element.args().record();

    MyTable_ds.findValue(fieldNum(MyTable, MyColumn), MyRefTable.MyRefColumn);

    (MyRefTable.MyRefColumn has the appropiate value that I should focus on the new table).

    Thanks, anyway :)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans