Skip to Content
0

How to get entity count from the $count(for example isDeleted is the entity)from odata.

Jul 26, 2017 at 12:58 PM

39

avatar image
Former Member

The error is found after debugging ie http: 415 unsupported media type this is the error am getting.

The code is here:

getTileCount: function(othis)

{ var that = this; var url = "/EQ_EquipmentAssignment/$count/?$filter=IsDeleted eq false;

return new Promise(function(resolve, reject)

{

that.oModel.read(url, null, null, false ,

function(oResponse) { resolve(oResponse); }, function(e) { reject(e); }); }); },

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Jamie Cawley
Jul 26, 2017 at 01:58 PM
0
Share
10 |10000 characters needed characters left characters exceeded
Srikanth KV Jul 27, 2017 at 05:30 PM
0

Use below code:

that.oModel.read("/EQ_EquipmentAssignment", {
        urlParameters: {
              "$inlinecount": "allpages"
        },
        filters: [
             new sap.ui.model.Filter("IsDeleted", "EQ", false)
        ],
        success: function(oData, Response){
           var nCount = oData["__count"];
           alert(nCount);
       }
});
Share
10 |10000 characters needed characters left characters exceeded
Sharath M G Jul 27, 2017 at 06:33 PM
0

var that = this; var url = "/EQ_EquipmentAssignment/$count/?$filter=IsDeleted eq false; - Is this line of code correct? Seems like an additional "/" before the "?". Remove it and test.

Regards,
Sharath

Share
10 |10000 characters needed characters left characters exceeded