AX 2012 Forms – Marking Records on a Form Data source

By Laura Lake | March 24, 2014

I wanted to manipulate records in a grid, marking as needed and then reading the marked records. I was able to find many examples for AX 2012 Forms on how to read marked records on a data source, but I found no clear examples on how to mark them. In the interest of having everything in one place, here is sample code for both.

The grid’s data source is the CompanyInfo table

AX 2012 Forms

Mark all records:

public void selectall(boolean _select)

{

CompanyInfo     localCompanyInfo;

localCompanyInfo = this.getFirst();

while(localCompanyInfo)

{

this.findRecord(localCompanyInfo);

this.mark(_select);




localCompanyInfo = this.getNext();

}

}

Read marked records:

CompanyInfo     localCompanyInfo;

localCompanyInfo = this.getFirst(1); //get marked

while(localCompanyInfo)

{

//do something




localCompanyInfo = this.getNext()

}

OR:

for(localCoInfo = CompanyInfo_ds.getFirst(1);localCoInfo;localCoInfo = CompanyInfo_ds.getNext())

{

//do something

}
Laura Lake
Our Verified Expert
Laura Lake

Laura Lake is a seasoned application developer with more 20 years of experience, specializing in Dynamics NAV and AX. She provided advanced developer support as an Escalation Engineer during her time at Microsoft, and later took on her role at Stoneridge Software leading client customizations and development workshops.
Her recent efforts include architecting tailored development solutions, guiding project teams through complex technical builds, and mentoring clients on extensibility within the Dynamics ecosystem. With a passion for robust, maintainable design, Laura brings expert craftsmanship and thoughtful leadership to every project.

Read More from Laura Lake

Related Posts


Under the terms of this license, you are authorized to share and redistribute the content across various mediums, subject to adherence to the specified conditions: you must provide proper attribution to Stoneridge as the original creator in a manner that does not imply their endorsement of your use, the material is to be utilized solely for non-commercial purposes, and alterations, modifications, or derivative works based on the original material are strictly prohibited.

Responsibility rests with the licensee to ensure that their use of the material does not violate any other rights.

Start the Conversation

It’s our mission to help clients win. We’d love to talk to you about the right business solutions to help you achieve your goals.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!