Friday, May 26, 2017

Lookup through X++ Code

Lookup through code based on selected control

public void lookup()
{
    Query query = new Query();
    QueryBuildDataSource qbds;
 

    // Instantiate sysTableLookup object using table which will provide the visible fields
    SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(BrandTable), this);
    ;

    // Create the query.
    qbds= query.addDataSource(tableNum(BrandTable));
   //Add range
  //Product Control set auto declaration YES
    qbds.addRange(fieldNum(BrandTable,Product)).value(Product.valueStr());

    // Set the query to be used by the lookup form
    sysTableLookup.parmQuery(query);

    // Specify the fields to show in the form.
    sysTableLookup.addLookupfield(fieldNum(BrandTable, Product));
    sysTableLookup.addLookupfield(fieldNum(BrandTable, Brand),true);
    sysTableLookup.addLookupfield(fieldNum(BrandTable, Description));

    // Perform the lookup
    sysTableLookup.performFormLookup();
}

No comments:

Post a Comment

update_recordset with joins

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