10 September 2022

Get the selected records in the form grid in class 

class ClassParmData

{

         CustTable custTable;// table buffer declaration

}

public static void main(Args args)

{

         ClassParmData parmData;

         Table1 table1;

         FormDataSource fds;

 

         if(args.record().TableId == tablenum(CustTable))

         {

                  custTable = args.record(); // assigning the selected record

         }

 

         fds = custTable.dataSource();// getting the datasource

 

         parmData= new ClassParmData(fds); //passing the form datasource to New() method

}

 

void new(FormDataSource fdst) // receving the datasource to fdst-FormDataSource

{

         // 1st optoin to do this

         MultiSelectionHelper helper = MultiSelectionHelper::construct();

        helper.parmDatasource(fdst);

         custTable = helper.getFirst();

         while (custTable.RecId != 0)

        {

                  custTable = helper.getNext();

         }

         // second way

         for(custTable = fdst.getFirst(true); custTable; custTable = fdst.getNext()) // fdst.getFirst(True) to select marked records

         {

                  info(strfmt(custTable.Field1));

         }

         //if you are updating some records in the form write the below line to refresh the data in form.

         //fdst.research();

}

 

void parmFormDataSource(formDataSource fdst)

{

         for(custTable = fdst.getFirst(true); custTable; custTable = fdst.getNext()) // fdst.getFirst(True) to select marked records

         {

         info(strfmt(custTable.Field1));

         }

         //if you are updating some records in the form write the below line to refresh the data in form.

         //fdst.research();

}

No comments:

Post a Comment

Give me the commetns and solutions

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension-...