mardi 11 octobre 2011

How to go through records in a grid of a form

Sometimes, simply selecting the lines you want in a datasource and pressing OK (or other button) is not enough for the users. They want to clearly see what they have selected, be able to easily modify the selecting, and to their liking whould be to see a checkbox on the left of the grid for each line. (For an example, see CustTransOpen form where you mark transaction with a checkbox)
Here is a simple tutorial form based on InventTable datasource. You can select multiple lines and process the lines by pressing Process lines button. 

www.axaptapedia.com/images/c/c9/Tutorial_Form_MultiSelectCheckBox.zip

and here is an example to go through records in a grid using Maps:

// Changed on 07 Oct 2011 at 16:10:00 by iba
void clicked()
{
    MapEnumerator           me;
    WMSOrderTrans           WMSOrderTransCopy;
    ;

    me = Map::create(selectedLines.pack()).getEnumerator();

    ttsbegin;
    while (me.moveNext())
    {
        select firstOnly forupdate WMSOrderTransCopy
            where WMSOrderTransCopy.RecId == me.current();
            if(InventItemInventSetUp::findDefault(WMSOrderTransCopy.itemId).HighestQty != 0)
            {
                WMSOrderTransCopy.splitByDefaultQty(InventItemInventSetUp::findDefault(WMSOrderTransCopy.itemId).HighestQty);
            }
    }

    selectedLines = new Map(Types::Int64,Types::Container);
   
    WMSOrderTrans_ds.research();

 
    if (selectedLines.exists(wmsOrderTrans.RecId))
    {
        selectedLines.remove(wmsOrderTrans.RecId);
    }

    ttscommit;
 
    super();
}


Aucun commentaire:

Enregistrer un commentaire