I was just wondering if there is any way of popping a lookup form during the program execution.
We have seen many ways of creating lookups – EDT’s, relations, AutoLookup and through custom code [SysTableLookup]
Let us consider an example: I have a select query whose behaviour should be dynamic based on the User input. We might have used query Framework classes many a times to do this.
I was just going through the standard classes and found this code useful with minimum tweaking of code.
Try out the below example: This example will help you to select the custAccount and based on the selected customer account it brings you the last invoiced sales order.
Note: The columns in the form are built runtime using the AutoLookup fields.
static void SR_expressionBuilderLookUp(Args _args)
{
CustTable custTable;
ExtendedDataTypeName extendedDataType = extendedtypestr(custAccount);
CustAccount custAccount;
Object expressionBuilderLookup;
Args args = new Args(formstr(SysExpressionBuilderLookup));
;
expressionBuilderLookup = new FormRun(args);
expressionBuilderLookup.parmExtendedDataType(extendedDataType);
expressionBuilderLookup.init();
expressionBuilderLookup.run();
expressionBuilderLookup.wait();
custAccount = expressionBuilderLookup.parmSelectedValue();
if(custAccount)
{
info(strfmt(‘Last SO of customer %1 is %2′, custAccount, CustTable::find(custAccount).lastInvoice().SalesId));
}
}
Below is the lookup image for your reference
We have seen many ways of creating lookups – EDT’s, relations, AutoLookup and through custom code [SysTableLookup]
Let us consider an example: I have a select query whose behaviour should be dynamic based on the User input. We might have used query Framework classes many a times to do this.
I was just going through the standard classes and found this code useful with minimum tweaking of code.
Try out the below example: This example will help you to select the custAccount and based on the selected customer account it brings you the last invoiced sales order.
Note: The columns in the form are built runtime using the AutoLookup fields.
static void SR_expressionBuilderLookUp(Args _args)
{
CustTable custTable;
ExtendedDataTypeName extendedDataType = extendedtypestr(custAccount);
CustAccount custAccount;
Object expressionBuilderLookup;
Args args = new Args(formstr(SysExpressionBuilderLookup));
;
expressionBuilderLookup = new FormRun(args);
expressionBuilderLookup.parmExtendedDataType(extendedDataType);
expressionBuilderLookup.init();
expressionBuilderLookup.run();
expressionBuilderLookup.wait();
custAccount = expressionBuilderLookup.parmSelectedValue();
if(custAccount)
{
info(strfmt(‘Last SO of customer %1 is %2′, custAccount, CustTable::find(custAccount).lastInvoice().SalesId));
}
}
Below is the lookup image for your reference