Need a special offer?Find out if your project fits.
+

How to send report slice using in in-built Save() method

Answered
Heman asked on June 4, 2019

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'
});

Attachments:
2.jpg

3 answers

Public
Vera Didenko Vera Didenko Flexmonster June 5, 2019

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

Public
Heman June 7, 2019

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');
 
}
})

Public
Vera Didenko Vera Didenko Flexmonster June 10, 2019

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

Please login or Register to Submit Answer