Automatic Data Type with Custom Caption


Hi !
I am using JSON datasource.
I am looking forward to set the caption on a field while also allowing the component to set the datat type automatically (expected to number). Is that possible?
The situation would be something similar to this snippet, but inseatd of setting the salary type explciitly to number, we only set the caption to “Gross Salary”, and leav WebDataRocks to detect the data type.
Is that possible?

4 answers

WebDataRocks Team WebDataRocks July 22, 2019

Hello Gabriel,
Thank you for posting your question here.
The CodePen example describes of how you can define your types explicitly. That information is stored in JSON meta-object. With the JSON meta-object approach the automatic data types detection is not possible. In such case the numbers type will be set with a default type, which is string.
As a workaround, you can use Slice approach to define custom captions:
WebDataRocks Team

Gabriel July 23, 2019

OK, I see but that way I would not let the user decide how the pivot table will look like as all the config (which field goes where) will be already on the slice. Right?

WebDataRocks Team WebDataRocks July 24, 2019

Hello Gabriel,
Yes, you are right. Such an approach has certain weak spots.
Still, for the measure fields, you can pre-set the caption and also add active: false property. In such a case, the caption will be applied add the measure field will not be selected into the report. 
However, please note that the JSON meta-object approach is a recommended one.
WebDataRocks Team

Gabriel July 24, 2019