cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Add multiple filter on same Column

Former Member
0 Likes
2,409

Hi All,

I have table to which I am binding data. Also there are 4-5 filter which I am  applying on table.

Everything work well but now condition is that, there is one Column name "STATUS". While binding data I don't want status with value "A" to get binded to table.
so I add filter as


var aFilter = [];

aFilter.push( new sap.ui.model.Filter("STATUS", sap.ui.model.FilterOperator.NE, "A"));

which is working fine.

now there is one more filter which is user define. so that when user select particular status only that rows should get bind to table
so I add one more value as


aFilter.push( new sap.ui.model.Filter("STATUS", sap.ui.model.FilterOperator.EQ, "B"));//Where B= user selected status

but this is not working. As both filter filter are on same column called "STATUS"

But when I remove first filter("A") then 2nd filter("B") filter work perfectly.

how can I add multiple filter on same column.
Such as I want STATUS != "A" AND STATUS = "B"(user define status)

Any help is appreciated

Thanks in Advanced.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

create a new filter which will perform AND on the aFilter array,


var combinedFilter = new sap.ui.model.Filter(aFilter, true); // true --> AND


JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.Filter

Former Member
0 Likes

oops, sorry, I mixed up OR and AND.

Answers (1)

Answers (1)

Former Member
0 Likes

HI Sanket

you need to have the array of filter in a filter like this

new sap.ui.model.Filter(aFilter, false); // false for OR

Thanks

-D