AX 2012 Forms – Marking Records on a Form Data source
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
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 }
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.