Code highlighting

Friday, November 24, 2006

Adding an AND condition in a queryRange

Wamr from AxForum found an interesing feature of fieldId2Ext global method:

    Query       q = new Query();
QueryBuildDataSource qbds;

qbds = q.addDataSource(tableNum(InventTable));

qbds.addRange(fieldNum(InventTable, ItemId)).value("8");
qbds.addRange(fieldid2ext(fieldNum(InventTable, ItemId),1)).value("2");

But you have to use it with caution, because you won't be able to find this range afterwards. 
so, searching for
qbr = qbds.findRange(fieldId2Ext((fieldNum(InventTable, ItemId), 1));
won't return you the range with the value "2", but the one with the value "8"
You can find the range, specifying the exact occurrence of it in the query:
qbr = qbds.findRange(fieldNum(InventTable, ItemId), 2);

No comments:

Post a Comment

Please don't forget to leave your contact details if you expect a reply from me. Thank you