Skip to Content
avatar image
Former Member

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

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)

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 29, 2017 at 06:27 AM

    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

    Add comment
    10|10000 characters needed characters exceeded