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

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...