Using Arcade to set transparency from date field

1020
1
Jump to solution
06-25-2020 06:47 AM
MichailaMusman
New Contributor III

I am trying to write an arcade expression for the "Set Transparency from Attribute Values" option in AGOL.

MY goal is to evaluate if a date field is empty and set a 50% transparency value if the field is NOT empty.  So the value in the field is not important, only if it is empty or not.  I have tried using an Iif/IsEmpty statement like this to create integer values that the transparency can be set from, but this doesn't seem to be working.

IIF(IsEmpty($feature.TrunkProtect), "0", "1")

I would also like to only apply this expression to points that have a creation year of 2017, which is tracked in a separate field.

 
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Hi Michaila Musman ,

With the expression you shared you are returning a text value and you want to return a numeric value. After that you will be able to configure how AGOL should interpret the value and stretch the transparency over the range of value returned by your expression. 

To make it more visually, return values and not strings:

Then you will get another window to specify how to apply the transparency:

And the result will be something like this (red, empty values, transparency of 50%):

View solution in original post

1 Reply
XanderBakker
Esri Esteemed Contributor

Hi Michaila Musman ,

With the expression you shared you are returning a text value and you want to return a numeric value. After that you will be able to configure how AGOL should interpret the value and stretch the transparency over the range of value returned by your expression. 

To make it more visually, return values and not strings:

Then you will get another window to specify how to apply the transparency:

And the result will be something like this (red, empty values, transparency of 50%):