Select to view content in your preferred language

Arcade symbology help

56
2
Jump to solution
7 hours ago
MarinaWinkler
New Contributor

Hello! I am struggling to write an Arcade expression that will symbolize point features based on the time value in a datetime field. I want to group the features by either AM or PM. I've tried extracting the time values using Time() which returns them as text ("08:00:00" or "12:00:00"), and then using Find() to recognize the text  and return another text ("AM" or "PM"), but it's still not working (see code below):

var timeString = Time($feature.TARGET_START_DATE)
if(Find("08",timeString, 0)>-1)
  return "AM"
  else if (Find("12", timeString, 0)>-1)
  return "PM"
 
this returns "AM" -- is this just the result for one feature in a feature class? because when I click Done to see if it applies itself to the dataset as a whole, I get an error message. I thought maybe it has to be in a loop, but for some reason the = in the var timeString becomes an unexpected token. I'm really stumped, and any help would be greatly appreciated!
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

You can use the Text function's formatting parameter "A" to return "AM" or "PM" for symbolizing the points.

Here's an example. These points are labeled with the Collection time field (FishDate in my data) and I use this expression to symbolize them.

Text($feature.FishDate, 'A')

 

 

Snag_c77e01.png

When you click Run in the Expression editor, it uses the first record in the dataset to evaluate the code. Clicking Done will run the code on the entire dataset (or at least the first thousand or so records) to build the symbology

View solution in original post

2 Replies
KenBuja
MVP Esteemed Contributor

You can use the Text function's formatting parameter "A" to return "AM" or "PM" for symbolizing the points.

Here's an example. These points are labeled with the Collection time field (FishDate in my data) and I use this expression to symbolize them.

Text($feature.FishDate, 'A')

 

 

Snag_c77e01.png

When you click Run in the Expression editor, it uses the first record in the dataset to evaluate the code. Clicking Done will run the code on the entire dataset (or at least the first thousand or so records) to build the symbology

MarinaWinkler
New Contributor

you're amazing!! it worked, thank you so much.

0 Kudos