How to connect to the remote JSON or csv file and load the FM pivot?

Answered
Kranthi asked 4 days ago

Hi Team,
I want to connect to the a JSON or CSV file which is located in remote folder. When I gave the datasource as below:

dataSource: {
                                filename: ‘\\UC260413-TPL-A\flex\flexmonster\JournalEntiresJSON.json’ 
                   },

 
I am getting below error.
Unable to open file flexmonster/\UC260413-TPL-AlexlexmonsterJournalEntiresJSON.json?435634736.

I am not sure why the flexmonsters component is being set as root folder. I think because that i am facing this issue.
But why the FM is looking in the component folder instead the folder
\\UC260413-TPL-A\flex\flexmonster\JournalEntiresJSON.json given.
 
 
If I put the JournalEntiresJSON.json file in flexmonster folder then pivot is working fine but when I put it any other folder pivot is not loading data because the component folder name is prefixing before the given other folder name as above.
 
Can you please help me how to load a csv or json file form any other folder instead from only component folder.
 
Thanks,
Kranthi
 
 
 
 

3 answers

Public
Vera Didenko Flexmonster 4 days ago

Hello, Kranthi,
 
Thank you for reaching out to us.
 
Please make sure that the componentFolder property is defined correctly.
For more information about the componentFolder please refer to our guide: https://www.flexmonster.com/api/new-flexmonster/
 
We would like to explain that the filename parameter can accept absolute paths, for example, https://cdn.flexmonster.com/data/data.json, and relative paths.
 
Relative paths need to comply with the following rules:

  1. if the URL is without / or ./ – the path will be resolved using the componentFolder + filename
  2. if the URL starts with / – the path will be resolved using the root directory (website root)
  3. if the URL starts with ./ – the path will be resolved using the current directory (current HTML page path)
  4. if the URL starts with ../ – the path will be resolved using the parent folder of the componentFolder

 
Please let us know if this helps.
 
Best Regards,
Vera

Public
Kranthi 3 days ago

Hi Vera,
In my case the component folder is the default flexmonster/ folder. I am not using any component property explicitly.
But Still I am facing error loading the csv file from remote folder given.
 
I am getting the CORS issue. I have set enable CORS property to * for all the sites. But still I am facing the CORS origin issue.
 
I am trying to access the csv file from remote folder as below from my server.
 

dataSource: {
                     filename: ‘//RemoteFolder/filename.csv’ },

 
 
I want to load the csv file form any remote location into pivot with the defalut component folder flexmonster/ given without any CORS issue.
 
Could you please help me over this.
 
Thanks,
Kranthi
 
 
 
 

Public
Vera Didenko Flexmonster 3 days ago

Hello, Kranthi,
 
Thank you for your reply.
 
1. We would like to confirm that the default componentFolder value can be used, setting the componentFolder property explicitly is not necessary.
2. We kindly suggest checking which errors are thrown in the browser’s dev console to get additional information about the problem.
Please share the error text in case any assistance is needed. 
 
Waiting for your reply.
 
Best Regards,
Vera

Please login or Register to Submit Answer