Monday, February 28, 2022

Process multiple selected record

1. Create a button ProcessSelected(Form Button Control , Text( On Hold(All Selected)), MultiSelect - Yes

2. Copy the event handler and remove static, We will be able to use this here.

 [FormControlEventHandler(formControlStr(VendTable, ProcessSelected), FormControlEventType::Clicked)]

    public void ProcessSelected_OnClicked(FormControl sender, FormControlEventArgs e)

    {

        this.processSelected(sender,e);

    }

3. ProcessSelected method

public void processSelected(FormControl sender,FormControlEventArgs e)

    {

        VendTable tmpVendTable, updateVendTable;         

        int recordUpdated;


        for(tmpVendTable = this.VendTable_ds.getFirst(true) ?

            this.VendTable_ds.getFirst(true) :

            this.VendTable_ds.cursor(); tmpVendTable; tmpVendTable =

            this.VendTable_ds.getNext())

        {

            ttsbegin;

            select firstonly forupdate updateVendTable where

                updateVendTable.AccountNum == tmpVendTable.AccountNum;

            updateVendTable.Blocked = CustVendorBlocked::All;

            updateVendTable.update();

            recordUpdated++;

            ttscommit;

        }

        info(strFmt("Total %1 records processed", recordUpdated));

    }


No comments:

Post a Comment

Sample Dialog Syntax - 1

 class AffiliationAutoAssignment extends RunBaseBatch {     // 1. Class Declaration and Pack variables     #define.CurrentVersion(1)     #de...