How to give data to report in FlexMonster

Answered
Osama Ameer asked on June 20, 2022

I am unable to load data which I am fetching from my nodejs server and passing it to report. The same thing I am able to do in html. Kindly response.
report: {
                 dataSource: {
                         /* URL to the Data Compressor Node.js */
                        // filename: "http://localhost:5000/",
                        data:res.recordset
                    },
                   }
I did this in html, how can I do this in react?? 

4 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 21, 2022

Hello, Osama!
 
Thank you for your question.
 
Here are some steps on how to connect Flexmonster to your local server using React framework:
 
1. Define the report in React component class. 
Kindly note you can use the filename property to specify the server endpoint, which returns the JSON data from your local server as follows:

report = {
      dataSource:{
            type:"json", 
            filename:"http://localhost:5000/"
      },
      ...
}

2. Add the report to the Flexmonster component as follows:

<FlexmonsterReact.Pivot  
  ref="pivot"  
  report={this.report}
  />

Kindly note that we used the JSON format in the example above, but the server can return CSV data as well.
 
To find more details on the React integration, please look through our sample project: https://github.com/flexmonster/pivot-react.
 
We hope it helps. Feel free to contact us in case of any other questions.
 
Regards,
Solomiia

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 28, 2022

Hello, Osama!

Hope you are doing well.

Our team is wondering if you had some time to check the suggested approach on embedding Flexmonster into the React application. Could you please let us know if it was helpful?

Looking forward to your response.

Regards,
Solomiia

Public
Osama Ameer June 28, 2022

Thanks! I've fixed it
Appreciate your support

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 28, 2022

Hello again!

Thank you for the quick response.

We are glad to hear that our solution was helpful.

Feel free to contact us if any other questions arise.

Best regards,
Solomiia

Please login or Register to Submit Answer