Skip to Content

How to pass search in oData.read along with filters

Hi,

I am trying to read oData service along with filters as below , which is working fine

this.getOwnerComponent().getModel().read(regPath, { async: false, filters: oFilters, success: function (oData, Response) { }, error: function () { busyDialog.close(); } });

But when try to add search to odata.read as below , it is ignoring search and giving me same results

this.getOwnerComponent().getModel().read(regPath, { async: false, urlParametrs: {"search": "200000002"}, filters: oFilters, success: function (oData, Response) { }, error: function () { busyDialog.close(); } });in Gateway client, i tried with URL where i can see the result

/sap/opu/odata/sap/EAM_OBJPG_MAINTORDANDOPER_SRV/C_ObjPgMaintOrderAndOperation?$filter=MaintenanceOrderType eq 'PM02' and (TechnicalObject eq 'p') & search=200000002

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Oct 28, 2019 at 09:37 AM

    Hi Jency Bala Muthiah,

    It's a small spelling mistake.

    urlParameters

    Thanks,

    Mahesh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 28, 2019 at 08:25 AM

    Hi,

    Pass it in the filter property.

    var aFilters = [];
    
    var oFilter = new Filter({
        path: "search",
        operator: FilterOperator.EQ,
        value1: 200000002
      });
    
    
    aFilters.push(oFilter);
    
    
    this.getOwnerComponent().getModel().read(regPath,
    { 
        async: false, 
        filters: aFilters, 
        success: function (oData, Response) {}, 
        error: function () { 
            busyDialog.close();
        }
    });
    
    

    Kind regards,

    Dries

    Add a comment
    10|10000 characters needed characters exceeded

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.