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

When first objects contains measures - type field with a null value it messes up aggregation

Resolved
Nikita asked on February 22, 2024

When we have a first object with such a key:
onlygroupbycolsprotocol/ic50: null
If next objects in the data array actually contain numeric values for that field, it will not matter for Flexmonster and instead of the specified aggregation by average, it is just counting the number of results. Is there a way to fix it?
If the first object actually has values that are non-null, it makes things work, but we can't rely on it.

4 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster February 23, 2024

Hello,

Thank you for reaching out to us.

Flexmonster might define data as string values by default if the first value is null. Sum and average aggregations are not supported for non-numeric fields. Therefore, it displays count aggregation, distinct count, etc. In such cases, component behavior requires defining the type of the fields. The proper way of defining the field's data type is using mapping. For example,

mapping: {
"Quantity": {
type: "number",
},
"Price": {
type: "number",
},
}

Kindly check the following JSFiddle for reference: https://jsfiddle.net/flexmonster/10xw6ch3/

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 5, 2024

Hello Nikita,

Hope you are doing well.

We were wondering if you found our solution helpful. Could you please confirm if it works for you?  

Looking forward to hearing your feedback.

Kind regards,
Nadia

Public
Nikita March 5, 2024

Sure, mapping solved the issue.
Thank you!

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster March 6, 2024

Hello,

Thank you for the feedback.

We are glad to hear that it works for you.

As always, feel free to reach out to us in case other questions arise.

Kind regards,
Nadia

Please login or Register to Submit Answer