Suppose this query against an OData4-backed view:
SELECT STRINGKEY FROM BQT1.SmallA WHERE LOCATE('1', stringkey) = 1
The WHERE clause gets translated into
filter=indexof('1',stringkey) eq 1
There are two issues with this:
- the arguments of the indexof function should be in the opposite order (the sought-after string goes second)
- indexof function indexes characters in strings from 0 whereas LOCATE from 1, this needs to be taken into account
The correct filter in this case should be:
filter=indexof(stringkey,'1') eq 0