Closed tjallingt closed 5 years ago
We're taking a look at this.
Great to hear! This would allow me to strip a really ugly hack out of my extension code 😅
@tjallingt What is the locale of you Desktop instance set to? If it's not en-US, can you try reproducing with it set to en-US?
My locale is set to en-US:
OK, It does have to do with your machine's locale and therefore how Tableau is displaying the parameter. With my os language set to English, I could not reproduce this ('0.1' showed 10.00% in the param), but then I changed my os language to French and that changed how Tableau was displaying the value in the param to 10,00% (similar to your screenshot). Now, I have to pass in '0,1' for it to work and '0.1' throws an error.
So in a way that feels consistent, but I also repro'd what you said about param.currentValue returning '0.1' even when the param is using commas for delimeters. So that is inconsistent and we also have to make sure the allowableValues gives you the right info to know what to pass in.
Thanks for letting us know about this.
Hey @Kovner thanks for your response, great to hear you figured out what is causing this strange behaviour 👍
So i see two bugs and a feature request here, the bugs (as i see it):
en-us
?)The feature request concerns the fact that obviously string representations of numeric values are not perfect (especially when casting is made difficult by different localisations of the same value). It would be great if allowableValues and changeValueAsync would just use floating point numbers for percentages.
I'm assuming the reason the extension API is spitting out strings is somehow tied to how Tableau is handling this data internally so there might not be a quick fix for that but perhaps the extension api could supply us with a localisation method that takes care of correctly formatting percentages for changeValueAsync (and all the other places values are expected to be localised of course)
Yep, I agree with all of that. We'll look into it soon, but I'm not sure whether any related fixes will be in v1 of Extensions API or post-v1. And if it's post-v1, we'll have to be sure to not make breaking changes.
Reproducable example: try the Parameter.changeValueAsync method on the Superstore workbook to change the "Churn rate" parameter.
This is especially confusing because it will return
DataValue.value === "0.1"
(point not comma 😖)