Skip to Content
author's profile photo Former Member
Former Member

odata call with filter

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Sep 16, 2015 at 05:12 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 16, 2015 at 06:01 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.