Friday, October 10, 2014

MultiSelect Lookup Example

In the ClassDeclaration of the form write the below code.

public class FormRun extends ObjectRun

{

SysLookupMultiSelectCtrl msCtrl;

}

Override the init method of the form and place the below code

public void init()

{

super();

// TestCtrl – Name of control on which you want a lookup.

// StudentCourse – Query to get the lookup data

msCtrl = SysLookupMultiSelectCtrl::construct(element, TestCtrl, querystr(StudentCourse));  // StudentCourse - Query

}

That’s it, Now let’s see how the selected rows are returned from the lookup.


public boolean modified()
{
    boolean ret;

    container c,v;
    int i;
    ret = super();
    if (ret)
    {
        c = msCtrl.get();  // get RecIds of the selected rows
        v = msCtrl.getSelectedFieldValues(); // get actual value of the selected rows

        for (i = 1; i <= conLen(c);i++)
        {
            info(conPeek(c,i));
            info(conPeek(v,i));
        }
    }

    return ret;
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...