Skip to main content

Notifications

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

  • Community Member Profile Picture
    on at
    Re: locate the current cursor of a table.

    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 :)

  • Martin Dráb Profile Picture
    232,866 Most Valuable Professional on at
    Re: locate the current cursor of a table.

    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();
    }
  • Luegisdorf Profile Picture
    1,930 on at
    Re: locate the current cursor of a table.

    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();

  • Community Member Profile Picture
    on at
    Re: locate the current cursor of a table.

    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 :)

  • Suggested answer
    Martin Dráb Profile Picture
    232,866 Most Valuable Professional on at
    Re: locate the current cursor of a table.

    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().

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,099 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans