Thursday 22 January 2015

How to retrieve selected and checked record from grid in Dynamics AX

There are two methods to retrieve the selected or marked records from a grid and a data source we use a loop to perform this operation there is a little bit difference in the code to retrieve the selected marked record and selected unmarked record.
1. When we want to retrieve the selected unmarked record we use the following code
StudentsChecked studentLocal;
super();
studentLocal = StudentsChecked_ds.getFirst (true);
for(studentLocal = StudentsChecked_ds.getFirst(true) ? StudentsChecked_ds.getFirst (true) :
StudentsChecked_ds.cursor (); studentLocal; studentLocal = StudentsChecked_ds.getNext ())
{
Info (studentLocal.Name +”–” +studentLocal.Id);
}
This loop returns the record that is pointed by cursor.
2. And when we want to retrieve the selected marked records we use the following code
StudentsChecked studentLocal;
super();
studentLocal = StudentsChecked_ds.getFirst (true);
for(studentLocal = StudentsChecked_ds.getFirst(true); studentLocal;
studentLocal = StudentsChecked_ds.getNext ())
{
Info (studentLocal.Name +”–” +studentLocal.Id);
}
This loop returns the records that are marked or checked.

No comments:

Post a Comment