How can I send report slice to my API along with additional data using in-built Save as show below
var newtabHandler = function() {
// add new functionality here
flexmonster.save({
//Is there any option available here to pass additional data ? //
filename: 'myreport.json',
destination: 'server',
url: 'https://yourserver.com/yourscript.php',
callbackHandler: 'reportSaved'
});
Hello, Heman,
Thank you for your question.
Please note that the save()
API call doesn't support customizing the content of the file which is to be saved.
We kindly suggest two ways how you can send additional data:
1) By using the save() API call and a callback handler
a) Use the save()
API call to save the current report.
flexmonster.save({
filename: 'myreport.json',
destination: 'server',
url: 'https://yourserver.com/yourscript.php',
callbackHandler: 'reportSaved'
});
b) In the callbackHandler
, you can provide the implementation for sending additional data. This will be executed after the report is saved.
function reportSaved() {
//send additional data
}
2) By using the getReport() API call and creating a custom request
a) Use the getReport()
API call to get the current report and construct a custom request to be sent (send the report and the additional data).
b) Provide the implementation for handling the request on the server side.
Please let us know if everything works fine for you.
Feel free to contact us in case any further questions arise.
We are looking forward to hearing from you.
Best Regards,
Vera
Thanks for your valuable reply.
I have used custom button which helps me get both report slice plus custom data to be send to the server.
this.reporttemplate.TemplateName='Template 1';
this.reporttemplate.TemplateJSON = JSON.stringify((this.pivot.flexmonster.getReport())); //get slice
this.apiService.AddReport(this.reporttemplate).subscribe((data: any) => {
if (data.ResponseCode == 0) {
alert('Template Saved');
}
})
Hello, Heman,
Thank you for your reply.
We are glad to hear that everything worked.
You are welcome to contact us in case any further questions arise.
Best Regards,
Vera