Pro 3.3.0
When inserting a Table Attribute in my layout I can choose to display a Thousands Separator when displaying a field (left) but when I compose an expression this choice disappears (right)
Is there a way to have a separator AND use an expression?
I have for example a surface of 2243 in a table which I would like to display as 2.234 ha. At the moment it displays either 2.234 or 2234 ha
I tried adding the separator in Arcade using
Text($feature.surface, '###,###') and that does work but displays a comma 2,234 where we would use a colon in the Netherlands. My locale is set correct (in Windows)
When using Text($feature.surface, '###.###') (with a colon) the colon is ignored.
Any advice would be appreciated, thanks for your time.
Bert
Solved! Go to Solution.
Unfortunately, Arcade doesn't support this directly (yet!) but you can do it manually with a find and replace. Here's some sample code from @JohannesLinder is in this post https://community.esri.com/t5/arcgis-pro-questions/arcade-label-dynamic-text-with-thousands-separato...
var value = 1234567890 / 1000
var x = Text(value, "#,###.0")
var pat_rep = [[".", ";"], [",", "."], [";", ","]]
for (var i in pat_rep) {
x = Replace(x, pat_rep[i][0], pat_rep[i][1])
}
return x + " kt"
// 1.234.567,9 kt
Also, the delimiter and decimal place options are disabled in the window when using an expression because they only apply to numeric data, and there is no guarantee when using an expression that a number will be the output. So you have to control those within the expression instead.
Unfortunately, Arcade doesn't support this directly (yet!) but you can do it manually with a find and replace. Here's some sample code from @JohannesLinder is in this post https://community.esri.com/t5/arcgis-pro-questions/arcade-label-dynamic-text-with-thousands-separato...
var value = 1234567890 / 1000
var x = Text(value, "#,###.0")
var pat_rep = [[".", ";"], [",", "."], [";", ","]]
for (var i in pat_rep) {
x = Replace(x, pat_rep[i][0], pat_rep[i][1])
}
return x + " kt"
// 1.234.567,9 kt
Also, the delimiter and decimal place options are disabled in the window when using an expression because they only apply to numeric data, and there is no guarantee when using an expression that a number will be the output. So you have to control those within the expression instead.