cancel
Showing results for 
Search instead for 
Did you mean: 

odata call with filter

Former Member
0 Kudos

Hi,

I am using odata to display data in a UI5 table like below:

var oModel= new sap.ui.model.odata.ODataModel( ".../customer_at.xsodata/", false);

oTable.bindRows("/_customer_at?$filter=ACTIVE_FLAG eq 'Y'");

Data is being displayed as expected in the table.

But when I try to filter on any of the fields in the table, no data is being displayed.

In other words, the problem is - if I use a filter in the odata call, I can't filter on any field in the table.

Appreciate any thoughts on this.

Thank you

Accepted Solutions (0)

Answers (2)

Answers (2)

pfefferf
Active Contributor
0 Kudos

Hello Shyam,

in the UI5 coding I would use sap.ui.model.Filter to define a filter. For your example like following:


...

oTable.setModel(oModel);

oTable.bindRows("/_customer_at");

...

var oFilter = new sap.ui.model.Filter("ACTIVE_FLAG", sap.ui.model.FilterOperator.EQ, "Y");

oTable.getBinding("rows").filter([oFilter], sap.ui.model.FilterType.Application);

...

Best Regards,

Florian

Former Member
0 Kudos

Hi Pfeffer,

Thanks for your response.

I tried as you suggested but did not solve the issue for me.

I ended up filtering data for active_flag in the view definition so users can apply filter as needed in the table.

patrickbachmann
Active Contributor
0 Kudos

Hi Shyam,

I'm not seeing an issue with your syntax.  I wonder if it's a data type issue.  Is ACTIVE_FLAG an nvarchar?

-Patrick

Former Member
0 Kudos

Hi Patrick,

Thanks for your response. ACTIVE_FLAG data type is varchar

-Shyam