flexmonster converts string data to a number

Answered
Jeff Morsch asked on May 4, 2022

We use dynamic json data to dynamically produce many different pivot reports using the same pivotgrid object/page.
We do not currently use mapping or the meta-object data header as described at https://www.flexmonster.com/question/flexmonster-show-string-data-as-number-and-add-extra-decimal-part/ 
But we are considering looking into it if it is our only option.
 
To demonstrate the issue I have 2 test fiddles:
this one pulls data correctly (using the meta-object data header):
http://jsfiddle.net/mv673u5w/1/
and this one converts the string field to a number which is not desired: (note the last record has an alpha character in it that gets lost):
http://jsfiddle.net/mv673u5w/2/
 
Is this auto conversion expected or is it a bug?
 
If the record with the alpha character appears earlier it seems to correctly keep it as a string.
Any suggestions?
 
Thanks,  and thanks for a great product!

1 answer

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster May 5, 2022

Hello, Jeff!
 
Thank you for contacting us and for your kind words about our product.
 
Kindly note this is a feature of Flexmonster to define data types automatically.
For that, Flexmonster takes the first object in the JSON array and tries to distinguish the data type. That is the reason why an alpha character is missing in your second example.
 
We highly recommend using mapping to set data types explicitly.
Please note that you can define the string data type for ProductSerialNo only and let Flexmonster automatically distinguish other data types.
 
You can find more details of JSON data representation in our docs: https://www.flexmonster.com/doc/managing-data-presentation-json/.
 
Feel free to contact us if any further questions arise.
 
Best regards,
Solomiia

Please login or Register to Submit Answer