How to save only the config without dataSource?


Is there some way to save just the configuration of fields/functions/formats
without dataSource tag in JSON file, and use this config to apply for a new
dataSource loaded in a future time?

2 answers

WebDataRocks Team WebDataRocks May 1, 2020

Hello, Edilmar,
Thank you for contacting us.
In order to remove the dataSource object from the saved report file, the following approach can be used.
Instead of saving the report using the save API call, it is possible to get it as inline JSON using the getReport method. Next, the received object can be modified in the desired way and saved locally or on the server using any available JavaScript tool.
Please note that such a report is not valid due to the fact the dataSource object is absent in it. Therefore, opening the report needs to be adjusted in an appropriate way as well. Instead of opening/loading the report using the open or load methods, the file needs to be loaded on the page using any available JavaScript tool and modified so that it contains all required parts (including the dataSource object).
After modifications, the report can be set using the setReport API call.
You are welcome to find out more about the mentioned methods in our documentation:

We hope it helps.
You are welcome to contact us in case of further questions.
Kind regards,
WebDataRocks Team

Edilmar May 1, 2020

Thanks for hint!
I got to do in my Java JSF app.
I have a RichFaces page with pivot built in, and Javascript functions for openConfig/saveConfig,
where I pass the parameters from JSF to JS, JS call REST methods in Payara Server to do open
and save configurations.