error to customise filter on ProductName

i want to filter my Product Name in my BOM lines , Form: :"BOMConsistOf "

table is “BOM” & ItemName is actually data method not a field . here in the below code am getting error in 3rd last line i.e( qb1.addlink(fieldnum( … )))


public void context()


int selectedMenu;

formrun fr;

Args ag;

Name strtext;

querybuilddataSource qb1;

queryrun qr; query q; PopupMenu menu = new PopupMenu(element.hWnd());

int a = menu.insertItem(‘Filter By Field’);

int b = menu.insertItem(‘Filter By Selection’);

int c = menu.insertItem(‘Remove Filter’);


selectedMenu = menu.draw();

switch (selectedMenu)


case-1: break;

case a: ag = new args(‘SysformSearch’);

fr = new formrun(ag);;


strtext =‘FindEdit’).valueStr();

if(strtext) { q = BOMVersion_ds.query(); qb1= q.dataSourceTable(tableNum(BOM));

qb1= qb1.addDataSource(tableNum(EcoResProductTranslation)); qb1.addLink(fieldNum(BOM,ItemName),fieldNum(EcoResProductTranslation ,Name)); qb1.addRange(FieldNum(EcoResProductTranslation,Name)).value(strtext);

BOM_ds.query(Q); BOM_ds.executeQuery(); }