openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

Filtering by multiple fields

Open grahamrobbo opened this issue 12 years ago • 2 comments

SAPUI5 filters do not seem to support OR condition across different fields. See example at http://jsbin.com/nexok/7/edit - note you will have to disable same origin policy to get data. I have a search field where I want to enter name and search across FirstName and LastName field. The filter condition produced is "$filter=substringof(%27Nancy%27,FirstName)%20and%20substringof(%27Nancy%27,LastName)", when what I want is $filter=substringof(%27Nancy%27,FirstName)%20or%20substringof(%27Nancy%27,LastName)

Cheers Graham Robbo

grahamrobbo avatar Jun 30 '14 06:06 grahamrobbo

Hi Graham,

filters are automatically ANDed if you only pass an array of filters into the filter function. If you want to OR the filters you have to use an additional filter, which applies the OR condition.

I changed your example here: http://jsbin.com/siliqali/1/edit

Regards, Christoph

cevou avatar Jun 30 '14 06:06 cevou

Thanks a million Chris - super fast response too. I owe you a beer if we ever are in the same place at the same time.

Cheers Graham Robbo

grahamrobbo avatar Jun 30 '14 06:06 grahamrobbo