Hello Guys,

We all know how to use lookups using SysTableLookup class and also Lookup forms. But there can be a need like when we select the lookup value we want to store the value in 2nd column in another field. For example InventLocationIdLookup on PurchTable form lines. When we select the Location the site id automatically pops up.

So consider the VendTableLookup form(as a reference) as our lookup form and we want to get the vendor name like below in our another field “name”

VendTableLookup

What we need to do is get the data source cursor value and change the value of the “Name” field as shown below.

On VendTableLookup

Declare the variables in class declaration

public class FormRun extends ObjectRun
{
rtnTestTable rtnTestTable;
FormDataSource rtnTestTableDS;
}

get the DataSource object in init method

void init()
{
rtnTestTableDS = element.args().record().dataSource();

super();

element.selectMode(vendTable_AccountNum);

}

Get the cursor and assign it to the Name field in our customized table

public void closeSelect(str _selectString)
{
rtnTestTable = rtnTestTableDS.cursor();

rtnTestTable.Name = DirPartyLookupGridView.Name;

super(_selectString);
}

Now you will get the Name as soon as u select the AccountNum from the VendTableLookup

op

🙂