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

How to set report json in to flexmonster.

Answered
Zain Asghar asked on January 20, 2023

I have read the doc about setting the report JSON file to the tool. But in my case, I'm getting a report JSON object from the backend and I need to set it to the tool directly. I don't have JSON file to load report.

4 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster January 20, 2023

Hello, Zain!

Thank you for writing to us.

Flexmonster allows loading the report from the file system or via URL. It is possible to set the report in the following way:

let pivot = new Flexmonster({
  container: "#pivot-container",
  toolbar: true,
  report: "http://localhost:3000/report"
})

Also, you are welcome to check out the following guide on how to restore the report via code: https://www.flexmonster.com/doc/save-and-restore-report/#restore-report

Please let us know if you found this information helpful.

Best Regards,
Maksym

Public
Zain Asghar January 23, 2023

Ok have read about it but the question is different. I don't have a file system or URL. I am saving the report JSON to the database and in response to the HTTP request I receive Report's JSON object. I need to set that Json to the tool.

Public
Maksym Diachenko Maksym Diachenko Flexmonster January 25, 2023

Hi, Zain!

Thank you for your reply.

It is possible to directly set the report JSON object into the component in the new Flexmonster() constructor if you have loaded it before component initialization. Setting the report object after the component is initialized is possible by using the setReport() API call. You are welcome to check the example: https://jsfiddle.net/flexmonster/L0n1r933/ 
Using these methods may work if you already have the report loaded to the client from the database, and you need to set it to the Flexmonster instance. 

Please let us know if using these methods fits your case.

Best Regards,
Maksym

Public
Maksym Diachenko Maksym Diachenko Flexmonster February 1, 2023

Hello, Zain!

Hope you are doing well.
Our team is wondering if you had time to check our previous answer about setting a JSON object to a report.
Please let us know if it helped you.

Best Regards,
Maksym

Please login or Register to Submit Answer