public void context()
{
int selectMenu;
FormRun formRun;
Args args;
Name strtext;
QueryBuildDataSource qbds;
QueryRun qr;
Query q;
PopupMenu menu = new PopupMenu(element.hWnd());
int a = menu.insertItem("filter by field");
int b = menu.insertItem("filter by selected field");
int c = menu.insertItem("close");
;
selectMenu = menu.draw();
switch (selectMenu)
{
case -1:
break;
case a:
args = new Args('SysFormSearch');
formRun = new FormRun(args);
formRun.run();
formRun.wait();
strtext = formRun.design().controlName('FindEdit').valueStr();
if (strtext)
{
q = TestOne_ds.query();
qbds = q.dataSourceTable(tablenum(TestOne));
qbds = qbds.addDataSource(tablenum(TestLink));
qbds.addLink(fieldnum(TestOne,Id),fieldnum(TestLink,Id));
qbds.addRange(fieldnum(TestLink,Name)).value(strtext);
TestOne_ds.query(q);
TestOne_ds.executeQuery();
}
break;
}
//super();
}
case b:
q = PurchLine_ds.query();
qb1 = q.dataSourceTable(tablenum(PurchLine));
qb1 = qb1.addDataSource(tablenum(InventTable));
qb1.addLink(fieldnum(PurchLine,ItemId),fieldnum(InventTable,ItemId));
qb1.addRange(fieldnum(PurchLine,ItemId)).value(Id.valueStr());
PurchLine_ds.query(q);
PurchLine_ds.executeQuery();
break;
case c:
q = new Query();
qb1 = q.addDataSource(tablenum(PurchLine));
qb1.clearLinks();
qb1.clearRanges();
PurchLine_ds.query(q);
PurchLine_ds.removeFilter();
break;
Default:
break;