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)

How to access the only data displayed in a grid in to some table?

(0) ShareShare
ReportReport
Posted on by

Hello I have a grid in Accounts receivable->Common->All Sales Order-> and so on.

Finally there is a Grid displaying some records. Now I want only these records that are displayed in a grid due to whatever condition, to be accessible in some other table. 

How can I access the data from the grid?

*This post is locked for comments

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

    Do you mean all data the data source (taking filters into account) or literally only the records displayed on screen (which decreases if you decrease the height of the form)?

  • Community Member Profile Picture
    on at

    All the data from grid that is being displayed presently when the grid is open taking filter into account. There is nothing like maximizing or minimizing the form.

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

    Let me make one more attempt in helping you to formulate your question.

    Let's say that the table contains 100 records. The data source has a filter and the filtered data set contains 50 records. When you open the form, only 20 records are displayed, because there is not enough space to show all 50 of them.

    Do you want to get all 50 records in the data source, even if 30 of them aren't actually displayed in the grid?

  • Verified answer
    syed baber Profile Picture
    11,633 on at

    Hi Mahesh,

    Do you want to refer to the data displayed in the grid within the same form? Is this something you are trying to achieve as shown in the following link:

    daxmusings.codecrib.com/.../multi-select-on-form-datasource-grid.html

    Thanks,

    Baber.

  • Community Member Profile Picture
    on at

    Thanks for the help. Yes I want all 50 records from the Grid irrespective of they are getting displayed or not. I don't want the records to be selected manually from the user. All the records from the grid must get transferred to some another table when I click OK button of the form.

  • Suggested answer
    Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    Get the query for your data source and do anything your like with it. Execute it again and fetch the data, pack the query and save it to database or anything else.

    YourTable_ds.query() returns the query defined on the form, YourTable_ds.queryRun().query() includes filters applied by user. You have to decide carefully which one you want.

  • Verified answer
    Community Member Profile Picture
    on at

    I got answer. My colleague's brother helped us.

    Go in the closeOk() method of form and write the code as below:

      //X++ code in Ax 2012 R2 to copy all the displayed grid data into a table

    //write inside closeOk() of Form

    SalesParmLine  paramline;

    CXT_DeliverDetails  _DeliverDetails;//Declare table buffers, 2nd is destination table

       paramline = SalesParmLine_Ds.getFirst();

       while(paramline)

        {

            _DeliverDetails.PackingSlipId = paramline.packingSlipId(paramline);

            _DeliverDetails.TransDate  = paramline.deliveryDate(paramline);

            _DeliverDetails.insert();

            info("Insert Succesfully ");

            paramline = SalesParmLine_Ds.getNext();

       }

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Others were also telling you same :)

    that is separate matter if you were able to understand them or not. As there is no space science in looping over records.

    Never mind, I think you was looking for code instead of a generic reply(as provided by Marin)

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

    If you believe that iterating the data source on client is more efficient then executing the query and inserting data on the server tier... I really don't think so.

    And using the query in insert_record (a new feature in AX 2012 R3) would be even more efficient.

  • syed baber Profile Picture
    11,633 on at

    Hi Mahesh,

    The link I provided earlier did the same thing which you have used in your code above. In addition to this, if you want to traverse through the selected records in grid, you can use MultiSelectHelper class as described in the link I mentioned in my previous comment.

    Please let me know if you need further help.

    Thanks,

    Baber.

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