Pricing changes are coming in January. Contact our Sales team to secure the current price for your desired license.

Export the contents of a CSV or JSON files and bypassing the CDN url

Answered
Youssef Shabo asked on May 23, 2024

Hello, I'm trying to get the actual contents of any json or csv file that is sourced via a url (CDN for example) to be exported to my server without the reference to the CDN. what's the best way to do so?

 

2 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster May 24, 2024

Hello, Youssef!

Thank you for your question.

Flexmonster's report can store data directly in the report using the DataSourceObject's data property. The solutions for saving the data loaded via filename would vary, depending on the data source:

CSV Data Sources

Flexmonster provides a straightforward way to save data using the save method with the embedData parameter for CSV data sources. This parameter allows the data to be embedded directly within the report, ensuring that the CSV data is preserved as part of the report's configuration. Here's a sample JSFiddle demonstrating how to use this method: https://jsfiddle.net/flexmonster/n6t754gf/ 

JSON Data Sources

When dealing with JSON data sources, there are a couple of approaches to ensure the data is saved within the report:

1. Preloading with Embedded Data: You can initially preload the data and then embed it into the report. Use the ready event to indicate that Flexmonster can receive API calls, load the data, and then set the report with data property via setReport method. This method ensures that the data is already stored within the report when the table loads: https://jsfiddle.net/flexmonster/shgrn41j/ 

2. Implementing a Custom Save Method: Alternatively, you can implement your own method to save the data. This involves fetching the data's current state from Flexmonster using the getReport() method to retrieve the current report configuration. After this, you should load the data from a URL, insert it into the report, and write a code for downloading the report: https://jsfiddle.net/flexmonster/39g4xyn0/ 

In addition, you can customize the toolbar so that its' "Save" tab will use the customized saving function: https://jsfiddle.net/flexmonster/f0Lvegnt/  

Please let us know if the approaches described work for you.

Best Regards,
Maksym

Public
Maksym Diachenko Maksym Diachenko Flexmonster June 20, 2024

Hello, Youssef!

Hope you are doing well.
We would like to know if you tried using one of the suggested solutions for saving the data from the remote source set inside the filename.
Please let us know if some of these approaches work for you.

Best Regards,
Maksym

Please login or Register to Submit Answer