Arcade Transparency Using Date Fields

1085
3
Jump to solution
05-26-2021 03:39 PM
Labels (1)
GIS_Fox
Occasional Contributor III

Hello Everyone,

I'm working out of ArcGIS Online, Dashboards, and Arcade to try and show points with varying transparency based on pre-set date fields and their relation to today's date, (not as of this posting but a constant that stays with the date of viewing. In Arcade I believe the 'TODAY' expression covers this by updating the value to the date as time progresses naturally).

I have two fields I'm working out of, InspectionDate and OneYear, (InspectionDate+12months). What I need to do is have the layer become less transparent as the date becomes closer to the date shown in the OneYear field under the custom transparency expression tab in AGOL. EG, a red flag symbolized point begins to show within oen month of the set OneYear date is roughly my goal. It should act as a visually graduated reminder to go and reinspect each point as time nears the one year since InspectionDate. Neither InspectionDate nor OneYear are variables and are set values. In theory the symbology should reset after the date passes. I've tried bringing in the fields as numbers or converting to numbers and percents with no change or progress. I don't have any great screenshots to share unfortunately, when not leaving blank results the transparency is frozen.

How can I bring in these fields and use Arcade to change transparency on a points layer if nothing else? Any input is greatly appreciated and hope this helps others in their projects.

Kind regards & God bless,

Jansen

City of Rio Rancho, NM

Records & GIS Section

Jansen Lyons - Records and GIS Section - Public Works - City of Rio Rancho, NM
0 Kudos
1 Solution

Accepted Solutions
CedricDespierreCorporon
Esri Contributor

Hello Jansen,

This should be something that could be directly managed from the MapViewer as it involves changes in the symbology. Could you have a look at the following blogpost that explains the process to calculate a time diffference and assign a specific symbology to it ?

You can make it more or less transparent depending on the same arcade expression.

Arcade: Calculating Relative Time for Popups and S... - Esri Community

I guess the change should be to calculate the datediff in days instead of hours : DateDiff(now(),$feature["field_xxxx"], "days") Hope it helps, Regards,

View solution in original post

3 Replies
CedricDespierreCorporon
Esri Contributor

Hello Jansen,

This should be something that could be directly managed from the MapViewer as it involves changes in the symbology. Could you have a look at the following blogpost that explains the process to calculate a time diffference and assign a specific symbology to it ?

You can make it more or less transparent depending on the same arcade expression.

Arcade: Calculating Relative Time for Popups and S... - Esri Community

I guess the change should be to calculate the datediff in days instead of hours : DateDiff(now(),$feature["field_xxxx"], "days") Hope it helps, Regards,

GIS_Fox
Occasional Contributor III

Hi @CedricDespierreCorporon , this does help, thank you kindly. I think besides the symbology fields, my biggest problem was finding the correct manner of coding the transparency to match what I hoped to achieve. Either drawing it out with longer code to be more precise or as you had shown with the concise line, "DateDiff(now(),$feature["field_xxxx"], "days") " 

This is certainly more to what I was thinking and I look forward to making the changes from hours to days or months from this blog post. Thank you very much again,

Cheers,

Jansen Lyons - Records and GIS Section - Public Works - City of Rio Rancho, NM
0 Kudos
GavinRossetti
New Contributor

Hi i'm trying to do something similar  - i want to symbolize a polygon layer so for each record if a field is empty, the polygon is only outlined. but if it is filled then it will be symbolised a certain colour/transparency.

0 Kudos