how to store report without data on server side and vice versa


I’ve implemented webdatarocks pivot in Angular 6 and it works great
i want users to save their slicing and dicing and filters so want to add a button to toolbar that saves the report configuration without data in my DB and when they select a report from menu now I sent JSON data from DB to client and that works but would like to send it with the configuration from the user as wll
any tips/directions please

4 answers

Ben Gorde September 13, 2018

I had the same trouble. Having looked through the list of all available API calls in this component, I found that getReport() fits perfectly for such case. It returns the JSON object with necessary information.

petervandeput September 13, 2018

You have example how to use it, I’ve tried without success with some sample data

petervandeput September 15, 2018

@Ben do you have some sample code (using Angular 6) since i cant get it working

Ben Gorde September 17, 2018

I don’t try it with the angular. Still, I will try to give you some guidance:

  • if you need to add some custom button to the toolbar you can start from this thread:
  • your handler will look something like this:
  • handler: function() {
    var report = webdatarocks.getReport();
    delete report.dataSource;
    //the code for saving the "report" JSON
  • then, when you need to restore it, you can create another custom button which should load such JSON from the file or from somewhere else and then include the "dataSource" part, after that you can call webdatarocks.setReport(report) to load the report