Hi! I feel like I'm missing something simple but the goal is to parse out null values in the pop-up (only show the field when it is populated), and I got that to work. However, I have some formatting I want to apply to the returned value (thousands seperator, adding a $ or %) that shows up in the Dictionary when I test run the code, but does not show up in the pop-up. I'm sure there's a simpler way to write this out too... Thanks!
Hey @AllieAnn3
I'm having a browser issue so I apologize if your docx covers this, the fields you're wanting to add the special formatting to, are they string fields? It appears they may be integers or another data value that won't take the special character values you've listed, the address takes them fine and the dictionary I believe treats all as if they are strings.
Cody
They are integers - I don't have any formatting on the Address which is the only string. When I use the text() function in an arcade expression, it honors the formatting even with the integers. Is it different when it's in an arcade element? Do you suggest I format them into strings first?
Thanks!
Hi @AllieAnn3,
One thing I would suggest trying is the following.
var FieldMap = {Address:'Address','<IncomeField>':'Ave Household Income','etc...':'etc...'}
var Values = []
Expects( $feature, '*')
for( var f in $feature ){
var N = $feature[f]
if( HasKey( FieldMap, f ) && !IsEmpty( N ){
if( F == ''){ N = Text( N, '##.##%' )}
//else if.....
Push( Values, Dictionary( FieldMap[f] , N ) )
}
}
return Concatenate( Values, '\n' )
/*
Note: Any value in text that you want to represent as a placeholder for a number
can use '#' to indicate the position or how many digits of the number to represent.
Whole numbers use '0' as representation. You can add any other characters to the front
or back to show percentages or any other value.
*/
I use code similar to this for more complex popups just to keep things simple. The 'Expects' may not work so you can optionally create a dictionary of matching fields and values to mimic something akin to this.