Custom lookup on InventTable

So you would like to create a custom lookup for the inventory table (Inventtable). As part of your design you include itemId and the display method ItemName. When you run the lookup you find the item name column is blank.

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

sysTableLookup.addLookupField(fieldNum(InventTable, itemid));
sysTableLookup.addLookupMethod(‘ItemName’);

Your code might look something like the above.

The problem occurs because the only fields of information being returned by the underlying query are based on the fields you are displaying, in this case itemid. The problem with that is you need product field to make the itemname display field to work. So as a result you need to include the product field to be displayed also, like below:

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

sysTableLookup.addLookupField(fieldNum(InventTable, itemid));
sysTableLookup.addLookupField(fieldNum(InventTable, product));
sysTableLookup.addLookupMethod(‘ItemName’);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s