Need a special offer?Find out if your project fits.
+

Escape characters csv vs flexmonster server

Answered
bartlomiej.buczek@sofomo.com asked on July 13, 2023

Hi,
I have an issue with flexmonster server. My csv always have double quotes like:

"Entity", "Whatever", "Something"

and in flexmonster pivot:

measures: [
{ uniqueName: "Entity", formula: average("Entity")...

However when I will use the same file with flexmonster server I have to do something like:

measures: [
{ uniqueName: '"Entity"', formula: average("Entity")...

so like adding quotes along with double quotes and formula does not work at all with issues like: The field with the 'Entity' uniqueName is not defined.
 
I need a help in either:
1. What should I use as an escape character for formulas?
or better
2. How to fix flexmonster server so it behaves the same as without using it?

4 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster July 14, 2023

Hello, Bartlomiej!
 
Thank you for reaching out to us.
 
We have reproduced the described parsing behavior of the Data Server for CSV files. Our development team will provide you with a fix by the ETA August 7th.
 
We also would like to provide you with some general practices for creating measures in Flexmonster:
 
1. How the calculated value formulas work in Flexmonster
Kindly note that while adding a calculated value, Flexmonster creates a new field for it, which is available in the FieldList in the Calculated Values folder. This way, the uniqueName of the new field should be different from the existing ones. For example:

measures: [
   {  
    uniqueName: "EntityMeasure",
    formula: 'average("Entity")'
   }
]

This way, Flexmonster would take the values from Entity field you provided, then aggregate them according to the formula, and store the results in the new EntityMeasure field.

2. Writing simple aggregations
If you just need to calculate the average, there is no need to create a separate calculated value. The average, or any other available aggregation, can be calculated as follows:

{   
    uniqueName: "Entity",
    aggregation: "average"
}

3. Multiple aggregations for the same field
If you need a couple of aggregations for the same field, Flexmonster can do that as well. You could just add them to your measures as follows:

measures: [
   {  
    uniqueName: "Entity",
    aggregation: "average"
   },
   {  
    uniqueName: "Entity",
    aggregation: "sum"
   }
]

 
If you have any doubts about syntax while creating a report, we recommend configuring a report using Flexmonster UI and saving the report.json file to see how it is generated by the component.
Here is a short video illustrating this approach: https://www.youtube.com/watch?v=GC4C7XLjccc.
 
Hope you will find our answer helpful.
We will notify you as soon as the fix is ready.
 
Kind regards,
Solomiia

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster August 9, 2023

Hello, Bartlomiej!
 
Hope you are doing well.
 
Our team is glad to inform you that the issue when quotes in a CSV header row were not ignored was fixed.
 
The fix is included in the 2.9.57 version of Flexmonster: https://www.flexmonster.com/release-notes/version-2-9-57/.
You are welcome to update the Data Server: https://www.flexmonster.com/doc/updating-to-the-latest-version/#update-data-server.
 
Please let us know if the fix works well for you.
 
Kind regards,
Solomiia

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster August 16, 2023

Hello, Bartlomiej!

Hope you are having a great week.

Our team is wondering if you had some time to test the fix with CSV headers in the Data Server.

Looking forward to hearing your feedback.

Kind regards,
Solomiia

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster August 23, 2023

Hello, Bartlomiej!

Hope you are doing well.

Just checking in to ask if the fix with CSV headers in the Data Server works well for you.

Looking forward to hearing from you.

Kind regards,
Solomiia

Please login or Register to Submit Answer