I am created Two Tables Like ProductTable and CustTable

in productTable fields are ProductType,ProductCode and ProductName

and CustTable fields are CustNum,CustName, ProductType ,ProductCode and ProductName

in ProductTable Data stored like

ProductType ProducCode ProductName

sofa 1 S1

sofa 2 S2

chair 1 C1

Chair 2 C2

Cot 1 CT1

Cot 2 CT2

so now i have to get data in CustTable

like in ProductType i have to get lookup with sofa,chair,cot

then where i select sofa in ProductType i have to load only s1,s2 in ProductName


suggest me some code as soon as possible

Thanks in Advance

If possible can any one send code to this mail


Hi Srinivas,

Take a String edit field for look up in the grid and override the lookup method of the Stringedit and in Properties of that control ,add datasource as ProductTable and datafield as " ProductType "…Do it a try and if any error comes,do post again.

thank you lalit

i got it


try like this…

first of all create an EDT for product type to fetch the data entered in product table to custtable…

and give that EDT to product type fields in both the tables…

now in order to get the product name based on the product type…

write this code in the product name datasource lookup method…

public void lookup(FormControl _formControl, str _filterStr)
Query query = new Query();
QueryBuildDataSource queryDataSourceCode;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup;
producttable producttable ;

sysTableLookup=SysTableLookup::newParameters(tableNum(producttable ),_formControl);
sysTableLookup.addLookupField(fieldNum(producttable , producttype));
sysTableLookup.addLookupField(fieldNum(producttable , productname));
queryDataSourceCode = query.addDataSource(tableNum(producttable ));
queryDataSourceCode.addRange(fieldNum(producttable , producttype)).value(custtable.producttype);


Dear Chaitanya Kumar

thank you very much for your code