Blog Listem

15 Kasım 2017 Çarşamba

AX 2012 - Multiselect Lookup

Bunun için AOT altında örnek bir form (tutorial_LookupMultiSelectGrid) ve hazır bir class var:

public class FormRun extends ObjectRun
{
    SysLookupMultiSelectCtrl msCtrl;
}


public void init()
{
    
    ...  
    super();
    ...
    
    msCtrl = SysLookupMultiSelectCtrl::construct(element, InventLocationIdExc, queryStr(InventLocationSRS));
    msCtrl.set(this.InventLocationList());
    ...
}

Listeyi aşağıdaki gibi alıp yukarıdaki init metod örneğindeki gibi okuyabiliriz.

container InventLocationList()
{
    Container           Ids,Names;
    InventLocation      location;
    int i;
    RecId               recId;

    for (i=1;i<=conLen(vInventLocationIdExc);i++)
    {
        recId = conPeek(vInventLocationIdExc,i);
        select firstOnly location
            where location.RecId == recId;
        Ids += location.RecId;
        Names += location.InventLocationId;
    }

    return [Ids,Names];
}

Pack metodda aşağıdaki gibi saklayabiliriz:

container pack()
{
    ...
    vInventLocationIdExc    = msCtrl.get();
    ...
}

Yukarıdaki MsCtrl.Get() metodu  RecId değerlerini verirken aşağıdaki de Field değerlerini verir:

container               c = msCtrl.getSelectedFieldValues();

Hiç yorum yok:

Yorum Gönder