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

Getting console error when trying to set data in dataSource object

Answered
Deepak Krishnan asked on February 20, 2024

I have attached the screenshot of console error which im getting when trying to setReport.
 
Code ->

 this.reportData = [
            {
                "Product Family": {
                    "type": "string",
                    "hierarchy": "Product"
                },
                "Unit Sales": {
                    "type": "number"
                },
                "Store Cost": {
                    "type": "number"
                }
            },
            {
                "Product Family": "Drink",
                "Unit Sales": 24597
            },
            {
                "Product Family": "Drink",
                "Store Cost": 19477.23
            },
            {
                "Product Family": "Food",
                "Unit Sales": 191940
            },
            {
                "Product Family": "Food",
                "Store Cost": 163270.72
            },
            {
                "Product Family": "Non-Consumable",
                "Unit Sales": 50236
            },
            {
                "Product Family": "Non-Consumable",
                "Store Cost": 42879.28
            }
        ]
          let report: any = this.pivotRef.flexmonster.getReport();
          report.options = {
            configuratorActive: false
          };
          report.dataSource.data = this.reportData;
          this.pivotRef.flexmonster.setReport(report);

Attachments:
Screenshot (140).png

3 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster February 21, 2024

Hello Deepak,

Thank you for reaching out to us.

We could not reproduce the described console error on our side. Could you please send us the code of the whole component (with the definition of Flexmonster)? It would greatly help us.
Also, please note that we recommend setting the data using the updateData API call instead of setReport. For more details on React integration, please check the following guide: https://www.flexmonster.com/doc/using-methods-and-events-react/.
 
Looking forward to hearing from you.

Kind regards,
Nadia

Public
Deepak Krishnan February 22, 2024

Hi ,
Thank you for the response . Using updateData instead of setReport worked for me.

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster February 22, 2024

Hello,

Thank you for the feedback!

We are glad to hear that it works for you. 

Do not hesitate to contact us in case other questions arise.

Kind regards,
Nadia

Please login or Register to Submit Answer