The trouble is you think you have time. Your success depends on how you utilize your time.

FormControl MultiSelect Lookup x++ Finance and operations

 FormControl MultiSelect Lookup x++ Finance and operations

First make the following class, just copy and past it:

class MoznumSysLookupMultiSelectGrid extends SysLookupMultiSelectGrid
{
    #Characters
    public void setSelected()
    {
        dictfield dictField;
        Common currentDSRecord;
        FormDataSource formdatasource;
        callingControlId.text(SysOperationHelper::convertMultiSelectedValueString(selectedId));
        formdatasource = callingControlId.dataSourceObject();
        if(formdatasource && callingControlStr.dataField())
        {
            dictfield = new dictfield(formdatasource.table(),callingControlStr.dataField());
            currentDSRecord = formdatasource.cursor();
            currentDSRecord.(dictfield.id()) = currentDSRecord.(dictfield.id()) + SysOperationHelper::convertMultiSelectedValueString(selectedStr);
            callingControlStr.update();
        }
        else
        {
            callingControlStr.text(SysOperationHelper::convertMultiSelectedValueString(selectedStr));
        }
    }
    public static MoznumSysLookupMultiSelectGrid construct(FormControl _ctrlId,
    FormControl _ctrlStr)
    {
        MoznumSysLookupMultiSelectGrid lookupMS;
        lookupMS = new MoznumSysLookupMultiSelectGrid();
        lookupMS.parmCallingControlId(_ctrlId);
        lookupMS.parmCallingControlStr(_ctrlStr);
        return lookupMS;
    }
}

then go to the control of your form, then click on method and by clicking right click override onlookup. then paste the following code in the lookup.

 [Control("String")]
    class MZNUKCustomerGradeEntitlement_Entitlement
    {
        /// <summary>
        ///
        /// </summary>
        public void lookup()
        {
         //   super();
            MoznumSysLookupMultiSelectGrid multiSelectGrid = MoznumSysLookupMultiSelectGrid::construct(this,this);       
            container inventLocationContainer ;
            QueryBuildDataSource qbds;
            Query query;
      
            query = new query();
            qbds = query.addDataSource(tableNum(MZNTRGradeEntitlementTable));
            query.dataSourceTable(tableNum(MZNTRGradeEntitlementTable)).addSelectionField(fieldNum(MZNTRGradeEntitlementTable, Entitlement));
            query.dataSourceTable(tableNum(MZNTRGradeEntitlementTable)).addSelectionField(fieldNum(MZNTRGradeEntitlementTable, Grade));
            qbds.addRange(fieldNum(MZNTRGradeEntitlementTable, grade)).value(queryValue( MZNTRCustomerGradeEntitlement.grade));
            multiSelectGrid.parmQuery(query);
            multiSelectGrid.parmCallingControl(this);
            multiSelectGrid.run();      
        }
    }

No comments:

Post a Comment