cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass search in oData.read along with filters

JencyBala
Employee
Employee
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

maheshpalavalli
Active Contributor

Hi Jency Bala Muthiah,

It's a small spelling mistake.

urlParameters

Thanks,

Mahesh

Answers (1)

Answers (1)

vvdries
Contributor

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

maheshpalavalli
Active Contributor

Will that option work? as "search" is a url parameter and the OP did a spelling mistake and it didn't work..

vvdries
Contributor

My bad, indeed. I thought the requirement was calling the data with a filter where X equals 200002.

Regards,

Dries