Reg PO

I have 3 forms that is… PurchTable, PurchLine & My form. In which projId are common. Myform having ItemId of my defined Items. I added a enum field in purchtable POtype. If I select POtype as Myproject then in Purchline itemid should come only my Myform Itemid. Can any one say how to solve the issue


I am assuming that:

1.You are referring to the standard “PurchTable” form (\Forms\PurchTable).

  1. You are using a seperate table “YourItemTable” as the datasource in your form in which you are storing your defined items. On the basis of the value in the newly added enum field POtype in Purchtable if you want to show only your defined items from the table “YourItemTable” in the lookup of the Item number field in the purchase order lines then you can override the lookup method in the PurchTable form as shown below:


void lookup()


Query query = new Query();

QueryBuildDataSource queryBuildDataSource;

QueryBuildRange queryBuildRange;

SysTableLookup sysTableLookup;


if (PurchTable.POType == POType::MyProject)


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

sysTableLookup.addLookupField(fieldNum(YourItemTable, ItemId));

sysTableLookup.addLookupField(fieldNum(YourItemTable, ItemName));

// Limit and arrange the data selection.

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

queryBuildRange = queryBuildDataSource.addRange( fieldNum(YourItemTable, ItemId));

// queryBuildRange.value(‘A…B’);