2
votes

According to the documentation:

The system uses Boolean OR logic to connect all the tags.

Does this mean that it is entirely impossible to construct a QueryCriteria which performs a boolean AND operation between multiple CriteriaElements?

1

1 Answers

5
votes

You should be able to get what you want by using a 'dirty trick' with queries. There is a way to put custom expressions in query ranges by using the DataArea field or the RecId field and putting in your expression.

Example:

query = new Query();
dsInventTable = query.addDataSource(tableNum(InventTable));

// Add our range
queryBuildRange = dsInventTable.addRange(fieldNum(InventTable, DataAreaId));

queryBuildRange.value(strFmt('((%1 == %2) || ((%1 == %3) && (%4 == "%5")))',
    fieldStr(InventTable, ItemType),
    any2int(ItemType::Service),
    any2int(ItemType::Item),
    fieldStr(InventTable, ProjCategoryId),
    queryValue("Spares")));

See the following link for more information : Expressions in query ranges