Select to view content in your preferred language

Attribute Expressions in AGOL

6871
13
09-18-2017 12:43 PM
VishalShah2
Occasional Contributor II

I'm currently looking at/researching how to edit attribute expressions and even change the color of text in the expressions. My problem is, I do not know how to go about it or which language to use that would be best.

Any links to articles/discussion/resources or even solutions are welcome! 

0 Kudos
13 Replies
XanderBakker
Esri Esteemed Contributor

How many colors do you have? In my example y have 3 values, hence the line:

var dct_grav = {"SOLO DAÑOS": "#ff8c00",  "HERIDO": "#ff0000", "MUERTO": "#800080"};

When the value is "HERIDO", the text "#ff0000" is returned. 

In your case you don't have a dictionary or object, but a single string:

var primaryColor = "#FAAF41";

In your case your code should be:

var primaryColor = {"your networkID value": "#FAAF41", "some other networkID value": "#AAAAAA"};

When you have a single value you would not need to use Arcade and could just hard code the color in the html code, but I am sure that that is not the case for you. 

Can you provide a  list of values in the field networkID and the corresponding colors?

0 Kudos
VishalShah2
Occasional Contributor II

So there are roughly 600 values in the NetworkID field, which is proprietary information to my company, and the color code I provided was the primary color my company uses and is associated with us. I am trying to change the text of the NetworkIDs to be the color of that color code ( #FAAF41). Right now, there is no vision as to where we are going with the attribute expressions capability of AGOL but my company wants me to get familiar with it and test it out on existing data we have to see what I can do with it and if I can get it working while the higher ups decide what they want customized. Hopefully that explanation helps a bit.

XanderBakker
Esri Esteemed Contributor

If you have a single color, then there is no need to use Arcade to define the color of the text, since it will always be the same. If you insist on using Arcade, it would be enough to have the color hard coded in the html code

XanderBakker
Esri Esteemed Contributor

Hi vshah6 , in additional to what I said before, it is really a very good thing to start exploring the possibilities of Arcade. Although it is already quite powerful, Arcade will start to play a much larger role in the ArcGIS Platform. There are some big things coming as part of the ArcGIS Utility Network Management extension for Enterprise, like attribute rules. 

0 Kudos