Hi, I am struggling with Arcade Expressions! I have a web map in agol that I am trying to customize the popup. I want to display different text based on the project status.
So if the Current Phase = Construction,
I want to display a sentence like "Project started in the {PROJ_BEGIN} of {BEGIN_YEAR} and is expected to be completed in the {PROJ_END} of {END_YEAR} "
my attribute expression
Any suggests would be greatly appreciated!
Solved! Go to Solution.
Having them in a domain makes a difference. You just have to make one change
var status = DomainName($feature, 'CURR_PHASE')
Oh thank you so much! It worked when I added that line. I am eternally grateful 🙂
That expression should work. What are the values in the field "CURR_PHASE"? You can see what is getting returned by adding in the console function in line 2.
var status = $feature.CURR_PHASE;
console($feature.CURR_PHASE)
var phrase = When (status == 'Construction', "construction sentence here",
status == 'Design', "design sentence here",
status == 'Completed', "completed sentence here",
"N/A")
return phrase;
In the popup expression window, click Run, then click the Console tab to see the results
Hi...added the console function and it returns N/A? The values for CURR_PHASE are in a domain called CIP_CURRENT_PHASE
Here is the information on that field...doesn't seem to be any issues there? Thank you so much for the help I have been driving myself crazy trying to get something to work!
Any ideas or maybe another work around? Because those values are in a domain do I need for reference them a different way?
Oops sorry, I forgot to click on the console tab! It is showing Closeout. So I updated to add all the values. But still showing N/A in popup?
Having them in a domain makes a difference. You just have to make one change
var status = DomainName($feature, 'CURR_PHASE')
Oh thank you so much! It worked when I added that line. I am eternally grateful 🙂