I have PurchId and PurchLineNum StringEdits on my form. Datasource is MyTable. I’m using relation to PurchLine on both fields, so after I choose PurchId, I can only choose the lines from this PO and it works perfectly.
I’m also using a filter on PurchId, I’m seeing only those PurchId-s which have at least one line with my ItemId (another field from MyTable). I accomplished this by overriding lookup method of PurchId StringEdit.
Now I want to override the lookup method of PurchLineNum to be able to choose only lines with my itemId, but when I use this code PurchLineNum can’t even show the lookup window, it just doesn’t do anything. What am I missing?
public void lookup()
{
Query query;
QueryBuildDataSource ds_PurchLine;
SysTableLookup sysTableLookup;
;
query = new Query();
sysTableLookup = SysTableLookup::newParameters(tablenum(PurchLine), this);
ds_PurchLine = query.addDataSource(tableNum(PurchLine));
ds_PurchLine.addRange(fieldNum(PurchLine, ItemId)).value(SysQuery::value(myTable.ItemId));
sysTableLookup.addLookupfield(fieldNum(PurchLine, LineNum));
sysTableLookup.addLookupfield(fieldNum(PurchLine, ItemId));
sysTableLookup.parmUseLookupValue(true);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
//super();
}
//P.S. Version is AX 2009 and PurchLineNum is PurchLine.LineNum