We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

get NaN in FM

Answered
Artsem asked on February 23, 2022

Hello support team,
There is a problem (1.png). 
Maybe, this happened when tried to get an average count of empty string.

I tried to recreate this problem, but when I want to set aggregation "sum", I see "count": https://jsfiddle.net/qgxr9ukc/15/
Thanks for your help.
Best regard,
Artsem

Attachments:
1.PNG

2 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster February 24, 2022

Hello,
 
Thank you for reaching out to us.
 
In such cases, component behavior requires defining the type of the fields. If there is no data for some measures in your dataset, Flexmonster defines them as string values. Sum and average aggregations are not supported for non-numeric fields. Therefore, it displays count aggregation. The proper way of defining the field's data type is using mapping. For example,

mapping: {
"Quantity": {
type: "number",
caption: 'Quantity',
aggregations: ['sum', 'count', 'distinctcount'],
},
"Price": {
type: "number",
caption: 'Price',
aggregations: ['sum', 'count', 'distinctcount'],
},
},

Kindly check the following JSFiddle for reference: https://jsfiddle.net/flexmonster/oqmzn73k/4/
 
Please let us know if it works for you. Feel free to contact us if other questions arise.
 
Kind regards,
Nadia

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster March 7, 2022

Hello, Artsem,
 
Hope you are doing well.
 
We were wondering if you had a chance to test a suggested approach.
 
Looking forward to hearing your feedback.
 
Kind regards,
Nadia

Please login or Register to Submit Answer