How to get marked records to container, List and how to load form data source

To get marked records to container:


// here list will store Some fields value in a table of the selected records. if we need some other field to be store in the list , we can change to required to field in place of  OMOperatingUnit field as well




public static server container getMarkedOMOpUnitRecords(FormDataSource CategoryOMOperatingUnit_ds)
{
container data;

afmCategoryOMOperatingUnit CategoryOMOperatingUnitLocal; // Table buffer

CategoryOMOperatingUnitLocal = CategoryOMOperatingUnit_ds.getFirst(1);

if (!CategoryOMOperatingUnitLocal)
{

data += CategoryOMOperatingUnitLocal.OMOperatingUnit;
}
else
{
while (CategoryOMOperatingUnitLocal)
{
data += CategoryOMOperatingUnitLocal.OMOperatingUnit;
CategoryOMOperatingUnitLocal = CategoryOMOperatingUnit_ds.getNext();
}
}
return data;

}
// to load data to form datasource in Class main method from multiselected grid value




public static void main(Args args)
{

FormDataSource formDS;

afmCategoryOMOperatingUnit afmCategoryOMOperatingUnitLocal;

afmEcommOwnedIOMopDeletion afmEcommOwnedIOMopDeletion;
 
afmEcommOwnedIOMopDeletion = new afmEcommOwnedIOMopDeletion();

if(args && args.dataset() == tableNum(afmCategoryOMOperatingUnit))



{

formDS = args.record().dataSource();

formDS.allRowsLoaded();

afmCategoryOMOperatingUnitLocal = args.record();

afmEcommOwnedIOMopDeletion.parmOMOperatingUnitRecId(afmEcommOwnedItemHandler::getMarkedOMopUnitRecords(formDS));

afmEcommOwnedIOMopDeletion.parmEcoResCategoryRecId(afmCategoryOMOperatingUnitLocal.EcoResCategory);

afmEcommOwnedIOMopDeletion.run();

}

 

}


To get the marked records from data source to List

// here list will store recId of the selected records. if we need we can some other field to be store in the list as well

public static List getMarkedRecords(FormDataSource ds_marked)
{
    List         recIds;
    Common       localCommon;
    recIds = new List(Types::Int64);
    for (localCommon=ds_marked.getFirst(1); localCommon; localCommon=ds_marked.getNext())
    {
        recIds.addEnd(localCommon.RecId);
        if (!localCommon.RecId)
            break;
    }
    return recIds;
}

 
 
 

Comments