cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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); }); }); },

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member365727
Active Contributor

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);
       }
});
Sharathmg
Active Contributor
0 Kudos

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

jamie_cawley
Advisor
Advisor
0 Kudos