Friday 19 September 2014

RETRIEVING MULTIPLE SELECTED RECORDS FROM GRID USING X++.

We want to follow some steps....

Step 1:

Create a new Table(Multiselecttable).Add the fields lilke Name,IdNumber.



Step 2:

Insert some records into the Table.

Step 3:

Create a new Form(MultiSelectForm) and Add the table as a datasource  into the Form.

Step 4:

Drag and Drop the fields into Grid under design node.

Step 5:

Create new Button(MultiSelectButton).Add the clicked() method under this Button.



Step 6:

Set the Property for Button Autodeclaration -->Yes and MultiSelect-->Yes.



Step 7:

Write the code for selecting multiple records.

void clicked()
{

    int             recordsCount;
    MultiSelectTable multiSelectTable1;
    super();

    recordsCount = MultiSelectTable_ds.recordsMarked().lastIndex();  // Total number of marked records.
  
  multiSelectTable1 = MultiSelectTable_ds.getFirst(1);

    while (multiSelectTable1)
    {
        info(multiSelectTable1.Name +" " +strFmt("%1",multiSelectTable1.Idnumber));
        multiSelectTable1 = MultiSelectTable_ds.getNext();
    }
}





No comments:

Post a Comment