Skip to Content
avatar image
Former Member

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jul 26, 2017 at 01:58 PM
    Add comment
    10|10000 characters needed characters exceeded

  • Jul 27, 2017 at 05:30 PM

    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);
           }
    });
    Add comment
    10|10000 characters needed characters exceeded

  • Jul 27, 2017 at 06:33 PM

    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

    Add comment
    10|10000 characters needed characters exceeded