Skip to Content

I am not able to extract more than 100 row thorough exporting .csv

Hi Experts,

I have set the sizeLimit of Odata before exporting the data from entity set.But still I am getting 100 rows data one.

This is the below code:

var model=this.getView().getModel().setSizeLimit(this.oTable.getBinding("items").iLength);

var Omodel=this.getOwnerComponent().getModel();

var oExport = new sap.ui.core.util.Export({ exportType : new sap.ui.core.util.ExportTypeCSV({ separatorChar : ";" }),

models :model,

rows : {path : '/AddressSet'},

columns : [{ name : "Vesrion", template : { content : "{Version}" }}, { name : "ProximusPointId", template : { content : "{ProximusPointId}"}}, { name : "Lang", template : { content : "{Lang}"}}, { name : "Name", template : { content : "{Name}" }}, { name : "CountryKey", template : { content : "{CountryKey}" }}, { name : "Street", template : { content : "{Street}" }}, { name : "HouseNo", template : { content : "{HouseNo}" }}, { name : "PostalCode", template : { content : "{PostalCode}" }}, { name : "City", template : { content : "{City}" }} ] }); oExport.saveFile().catch(function(oError) { MessageBox.error("Error when downloading data. Browser might not be supported!\n\n" + oError); }).then(function() { oExport.destroy(); });

Kindly please help me.

Thanks

Peeyush Ranjan

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • May 08 at 09:31 AM
    -1

    Hi Peeyush,

    Can you try this,

    var JsonModel = new sap.ui.model.json.JSONModel();

    JsonModel.setSizeLimit(oData.results.length); //Setting size limit

    JsonModel.setData(oData);

    that.getView().setModel(JsonModel, "newModel");

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Srikar,

      I have wrritten the below code.

      var JsonModel = new sap.ui.model.json.JSONModel();

      JsonModel.setSizeLimit(this.oTable.getBinding("items").iLength); //Setting size limit JsonModel.setData(this.getOwnerComponent().getModel().oData);

      this.getView().setModel(JsonModel, "newModel");

      var model=this.getView().getModel("newModel");

      and the model i have provided in export models:model,

      But i am getting now blank screen :(

      Thanks

      Peeyush

  • May 08 at 06:52 PM

    Dear Peeyush,

    as far as I can see you set sizeLimit of the model after the Binding on your list was done.
    So your Binding Request was still called with $top=100.

    There are multiple solutions to your problem. Pick the one you prefer:

    1.) set sizeLimit of your model before the Binding is done e.g. in init method of your Component

    2.) Don't set sizeLimit to the number of entities which you got through the Binding

    3.) Alter your binding to something like this:

    ... rows : {path : '/AddressSet', length: 500}, ...

    Hope this helps.

    Kind regards,

    Sebastian

    If you want you can check out my Blog where I wrote an article about this subject.

    This could contain a link to some awesome kind of Blog

    Add comment
    10|10000 characters needed characters exceeded