Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
Yianni_Ververis
Employee
Employee

Working on one of our projects, the requirement was to export the object data. It seems though, 2.1 does not let you do that. I used both:

app.getObject(value, value).then(function(model){

model.exportData()

and

qlik.table(model).exportData({download: true})

Both of them returned error

Object {code: 403, parameter: "REST HTTP error", message: "Forbidden"}

Until this bug is fixed, I have created a workaround. A new directive that will handle the export by accepting Dimensions and Measures, passing them to the api service.  This is for every Hypercube we want to create which is also for the objects like stacked bar chart that 2.1 does not have the ability to export yet. I believe this is fixed in 2.2 though!

We will use the template from Creating a website with Angular and the Capabilities API.

In controllers/dashboard.js add the Dimensions and Measures for export

  $scope.export = [

  {

     headers:['Case Owner Group', 'Avg Case Duration'],

     data:[['Case Owner Group'], ["Avg([Case Duration Time])"]]

  }

  ];

In the views/dashboard.html add a button that will use the new directive

<button class="btn btn-default pull-right" export-to-csv data="export[0].data" headers="export[0].headers" title="'myFileName'">Export</button>

git: https://github.com/yianni-ververis/capabilities-api-angular-template

Branch: Qlik Branch