Skip to Content
0

Complex filter query using SAP iOS SDK (search by text)

Apr 28, 2017 at 08:58 AM

135

avatar image
Former Member

Hello,

I am having issues in order to do a "complex" filter request using the iOS SDK DataQuery class. What I would like to achieve is to search if one attribute contains an string (basically a substring() operator).

Using an string query it should be as simple as this:

$filter=substring('text', ObjectName) eq true

Is it possible to perform the search using the filter method from DataQuery class?
DataQuery().filter("substring('\(text)',ObjectName eq true”)

(obviously this is not valid because filter method is not accepting an string predicate parameter)

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Florian Pfeffer
Apr 29, 2017 at 06:27 AM
1

Hello Eloi,

I do not get your OData example, execpt you mean the "substringof" function instead of the "substring" function (for the "substring" function your arguments to not match).

If that is the case, the substringof function is equivalent to a QueryFunction.contains operation.

Something like the following dummy coding (consider that of course the EntityValueClass.propertyName has to be replaced by the property name on which you wanna do the contains aka substringof operation):

let queryFunc = QueryFunction.contains(EntityValueClass.propertyName, searchValue: "test")
let queryFilt = QueryFilter.from(qfunc)
let query = DataQuery.select(...)
let query = query.filter(queryFilt)

Regards,
Florian

Share
10 |10000 characters needed characters left characters exceeded