Product/Item Lookup

Hi Everyone,

Good Day!

I need your guide and help, i need some references, links, tutorials.

OK here’s the thing, i create a form and add Grid, in the first column i want to add Lookup value which is Product/Item Master, upon selecting the Item
i want to get the following details.

ITEM CODE
DESCRIPTION BAR CODE BRAND CATEGORY LAST PURCHASE PRICE
0000000001 ITEM 1 12345 SEAGATE HDD
100
0000000002 ITEM 2 67890 ECO SUPPLY 50

should have any question or clarification just let me know.

i will appreciate your quick response with regards to my concern…

Thank you in advance.

Hi JEMT,

I have a question is all the fields are coming from the same table or from different tables?

If it is a from the same Table you can override the Lookup method and add the following code

public void lookup()
{
    Query query = new Query();
    QueryBuildDataSource queryBuildDataSource;
    QueryBuildRange queryBuildRange; 

    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(TableName), this); 

    sysTableLookup.addLookupField(fieldNum(TableName, FIELD));

    queryBuildDataSource = query.addDataSource(tableNum(TableName));

    sysTableLookup.parmQuery(query);

    sysTableLookup.performFormLookup();

    //super();
}

and also override the modified method for the same field and in that write the code to get the selected ItemCode and from that, you can get all the fields from the table.

Hi Thomas,

Thank you for your response, your code is really helpful but already finished doing the Lookup.

what i trying to achieve now is on how to get value from the selected record from the lookup and put it in other fields which is in the grid as i mention above.

As Thomas said you could use the Modified method of the particular control or field in the Grid. override the modified method and them write a query to bring up the required fields in the form datasource. NOTE: directly assign value to the form datasource like DataSource.Field = your Value.