Friday, November 26, 2021

get selected record from Lookup



based on selected record from parent code lookup modify item id in purchase order.

create a new custom lookup form as shown below.


override closeselect   method :

Public void closeselect(str  _selectString)
{
FormRun      formrun;
Object          formrunobj;

     super(_selectString);

if(element.args() != null
    && element.args().caller() != null
   && SysDictClass::is(element.args().caller(),classnum(FormRun ))
    {
        formrun = element.args().caller();
        if(formHasMethod(formrun,identifierstr(PurchTable)))
        {
          formrunobj = formrun;
        }
}

}

override init method :

set  Autodeclaration Yes Highlited control in 

Public void int()
{
    super();
    element.selectMode(InventTable_ParentCode);
}

override runmethod :

Public void run()
{
    FormStringControl         callingcontrol;
    boolean                           filterlookup;
    FormRun                        formrun;
        
   if(element.args()  && element.args().caller())
    {
        if(SysDictClass::is(element.args().caller(),classnum(FormRun )))
        {
            formrun =  element.args().caller();
        }
    super();
    
}

call Lookup form in ParentCode control level in PurchTable form.

Public void lookup()
{
      Args       args = new Args();
     FormRun      lookupform;
    InventTable       inventTable;

    args.name(formstr(parentlookup));
    args.parm(PurchLine.ItemId);

    lookupform = new FormRun(args);
    lookupform .init();
    this.performFormLookup(lookupform);
    lookupform.wait();

    if(lookupform.closeOk())
    {
        inventTable = lookupform.docCursor();
    }

}

Get RecId from inventTable modify ItemId from modified method.

No comments:

Post a Comment

update_recordset with joins

 update_recordset with joins update_recordSet storeTransfer         setting      TransactionId = transfertable.TransferId     join transfert...