I have to build a specialized form which queries the InventTrans
table for some purchase transactions.
The transactions must be selected, either with a non-empty Voucher, either with a non-empty Packing slip Id (PackingSlipId
).
While looking how to specify this in a query range, I found that it was possible to associate this query range to the RecId
of the table. Is this the usual and classic way to do this ? See my example (which seem to work).
QueryBuildDataSource qbds;
;
qbds = this.query().dataSourceTable(tableNum(inventTrans));
sysQuery::findOrCreateRange(qbds, fieldNum(InventTrans, RecId)).value(
strfmt('(%1 != "") || (%2 != "")',
fieldstr(InventTrans, Voucher),
fieldstr(InventTrans, PackingSlipId)));
Those are called range expressions and is the only way to state more complex queries with a Query
object - see this MSDN page
In addition have a look at this Axaptapedia page (thanks to FH-Inway)
Regarding if it is the classical way: No - only use it if necessary