Get Free Trial

Datasource json does not read correctly

Thomas Sverker asked on March 24, 2020

I’m having trouble reading our report’s datasource json after updating to 2.8.2. Data is CSV data read through a backend endpoint.
There seems to be a difference in how the json is read between version 2.7 and 2.8. After updating the json below cannot be read. The data is correctly read from backend but all settings concerning which rows/columns/filters should be shown in the report seems to be in an incorrect format and are not shown. When I click the Fields menu button I can see all the fields, and select them. I can however not add any calculated fields.
How can I change the v2.7 format to v2.8 format? This should be included in the migration guide!
See example (linearized):
{ “dataSource”: { “dataSourceType”: “ocsv”, “filename”: “” }, “slice”: { “pages”: [{ “uniqueName”: “Säsong”, “filter”: { “members”: [“säsong.[20162]”] } }, { “uniqueName”: “Vgrp Hgrp” }, { “uniqueName”: “Lev status” }, { “uniqueName”: “Ordertyp”, “filter”: { “members”: [“ordertyp.[inventeringsorder]”, “ordertyp.[ib]”], “negation”: true } }, { “uniqueName”: “VM”, “filter”: { “members”: [“vm.[13 j lindeberg]”, “vm.[20 gestuz]”, “vm.[16 twist & tango]”, “vm.[19 malene birger]”, “vm.[15 ilse jacobsen]”, “vm.[22 björn borg]”, “vm.[24 casall]”, “vm.[31 opi]”, “vm.[33 tangent]”, “vm.[39 rodebjer]”, “vm.[40 atp atelier]”, “vm.[41 peak performance]”, “vm.[42 komono]”, “vm.[46 filippa k]”, “vm.[45 stylein]”] } }], “rows”: [{ “uniqueName”: “Hgrp”, “filter”: { “members”: [“hgrp.[22 skor]”, “hgrp.[23 accessoarer]”, “hgrp.[19 sport]”, “hgrp.[24 smycken]”, “hgrp.[25 övrigt]”, “hgrp.[91 mat]”], “negation”: true } }, { “uniqueName”: “Butik”, “filter”: { “members”: [“butik.[2 sollentuna]”], “negation”: true } }], “columns”: [{ “uniqueName”: “[Measures]” }], “measures”: [{ “uniqueName”: “Budget belopp”, “aggregation”: “sum” }, { “uniqueName”: “Ordervärde kr”, “formula”: “sum(\”[Order antal]\”) * sum(\”[Var kostpris]\”) “, “individual”: true, “caption”: “Ordervärde kr” }, { “uniqueName”: “OTB Kr”, “formula”: “sum(\”[Budget belopp]\”) -\”[Ordervärde kr]\””, “caption”: “OTB Kr” }, { “uniqueName”: “OTB kr %”, “formula”: “100-100* \”[Ordervärde kr]\”/sum(\”[Budget belopp]\”)”, “caption”: “OTB kr %”, “format”: “1yfgo97g” }, { “uniqueName”: “Order antal”, “aggregation”: “sum” }, { “uniqueName”: “Snittpris”, “formula”: “\”[Ordervärde kr]\” / sum(\”[Order antal]\”) “, “caption”: “Snittpris”, “format”: “22ut3umn” }, { “uniqueName”: “Formula #1”, “formula”: “sum(\”[Budget antal]\”) – sum(\”[Order antal]\”) “, “caption”: “OTB Antal”, “active”: false }, { “uniqueName”: “OTB Antal %”, “formula”: “100* sum(\”[Order antal]\”) /sum(\”[Budget antal]\”) “, “caption”: “OTB Antal %”, “active”: false, “format”: “1yfgqsp7” }] }, “options”: { “showEmptyData”: false }, “conditions”: [{ “formula”: “if(#value <= 0, ‘trueStyle’)”, “trueStyle”: { “backgroundColor”: “#FFFFFF”, “color”: “#000000”, “fontFamily”: “Arial”, “fontSize”: 12 } }], “formats”: [{ “name”: “1yfgo97g”, “thousandsSeparator”: ” “, “decimalSeparator”: “.”, “decimalPlaces”: 0, “maxSymbols”: 20, “currencySymbol”: “”, “currencySymbolAlign”: “left”, “nullValue”: “”, “infinityValue”: “Infinity”, “divideByZeroValue”: “Infinity”, “textAlign”: “right” }, { “name”: “1yfgqsp7”, “thousandsSeparator”: ” “, “decimalSeparator”: “.”, “decimalPlaces”: 0, “maxSymbols”: 20, “currencySymbol”: “”, “currencySymbolAlign”: “left”, “nullValue”: “”, “infinityValue”: “Infinity”, “divideByZeroValue”: “Infinity”, “textAlign”: “right” }, { “name”: “22ut3umn”, “thousandsSeparator”: ” “, “decimalSeparator”: “.”, “decimalPlaces”: 0, “maxSymbols”: 20, “currencySymbol”: “”, “currencySymbolAlign”: “left”, “nullValue”: “”, “infinityValue”: “Infinity”, “divideByZeroValue”: “Infinity”, “textAlign”: “right” }], “tableSizes”: { “columns”: [{ “idx”: 0, “width”: 267 }] }, “version”: “2.8.2”, “creationDate”: “2020-03-24T15:04:37.914Z” }

2 answers

Vera Didenko Vera Didenko Flexmonster March 25, 2020

Hello, Thomas,
Thank you for reaching out to us and for sharing your report configuration.
We would like to explain that between the 2.7 and the latest 2.8 version there were no major changes done to the report object’s structure.
However, we have noticed that in your report configuration in the calculated values’ formulas the fields are surrounded by square brackets ( [ ] ), for example:

"uniqueName":"Ordervärde kr",
"formula":"sum(\"[Order antal]\") * sum(\"[Var kostpris]\") ",
"caption":"Ordervärde kr"

This is the reason why the report is not loaded and adding calculated values doesn’t work. 
Our team is working on the solution to this issue and the fix will be available in the minor release version with the ETA 6th of April.
As a workaround, we kindly recommend referring to the fields without square brackets.
Please let us know if this helps and if you have any questions.
Kind regards,

Mykhailo Halaida Mykhailo Halaida Flexmonster April 8, 2020

Hi Thomas,
We are happy to let you know that the exception when using invalid names in a formula for calculated values was fixed. 
It is also important to mention that in version 2.7 there was an inconsistency in calculated formula validation when using measures for formulas with square brackets in measure name ([MyMeasure]), even though those are not present in the measure definition (MyMeasure). In this case, the pivot table would display such values, but they wouldn’t be calculated correctly.
Since the latest version, a pop-up warning is displayed if there is a similar inconsistency in measure naming. This pop-up can be avoided by disabling the validateFormulas option, which is, however, not recommended.
Feel free to check out the following JSFIddle example illustrating the described behavior:
This is available in the 2.8.4 version of Flexmonster:
You are welcome to update the component. Here is our updating to the latest version tutorial for guidance: 
As always, feel free to reach out if you have any questions we can help you with.
Best regards,

Please login or Register to Submit Answer