I am building a search in a RESTlet. I am stuck on creating an elegant filter based upon transactionumber. I would like to filter it with an ANYOF operator, passing in an array of numbers for values, but that does not seem possible.
The only solution I have found is to pre-process the array into a string of numbers and use a conditional SQL function to test it:
search.createFilter({
name : 'formulanumeric',
formula : 'case when TO_NUMBER({transactionnumber}) in ('
+ tranids.join(',') // e.g. in (741,744)
+ ') then 1 else 0 end',
operator : search.Operator.NOTEQUALTO,
values : 0
});
Surely there is a better way. The above has a (slight) performance hit of converting the array to a string and I'm concerned about limitations of the formulanumeric field -- i.e. length of the formula string.