7
votes
Creating Arcade Expression that excludes empty field values
You must test IsEmpty for each value. You may try this code using the Labeling Profile at the Arcade Playground
//Array to hold values and an index
var i = 0;
var features = [];
//Add value to array ...
7
votes
Accepted
Multiple If statements in one ArcGIS Arcade Expression
Define a string variable, build it out, and return it at the end, instead of multiple returns:
var result = ""
if ($feature["Road_Work_Ahead_Deployed"] >= 1){
result += &...
5
votes
Accepted
ArCade Expression in Pop-Up- change color based on attribute
The Answer was to create a specific Arcade Expression per "Value" that I wanted and identify each expression in the pop-up config with a different color text.
Expression 0: IIf($feature.status=='...
5
votes
Multiple If statements in one ArcGIS Arcade Expression
You can use the IIf() function and return an empty string ("") or null when the condition is false, and use Concatenate() to join both terms (although the + operator also works):
var var1 = $...
5
votes
Accepted
ArcGIS Arcade Determining if a sorted array of numbers has consecutive numbers within it
Arcade is heavily influenced by JavaScript, so it is good to look to JavaScript examples when trying to figure out Arcade issues that are non-geospatial in nature. There might be a similar JavaScript ...
4
votes
Accepted
Evaluating string in Arcade 'if' statement?
I've just done a quick test in ArcGIS Pro 2.1. A Find('text to find', 'text to search in', 0) seems to work. I've only tested on a handful of features, so I'm not sure what performance is like in a ...
4
votes
Accepted
Arcade IIF function, return field name plus string
I believe this line:
IIF($feature["YEAR_BUILT"]=="0", "No Data", "The building was built on $feature["YEAR_BUILT"].")
needs to be:
IIF($feature["YEAR_BUILT"]=="0", "No Data", "The building was ...
4
votes
Accepted
Using Arcade to label, using coded values in ArcGIS Pro
If you are labelling a feature which has a Domain on the field then this appears to be automatic in ArcGIS Pro, you see the description not the code. The function is DomainName() and has the syntax ...
4
votes
Accepted
Finding number of days per ID in table using ArcPy?
An alternative approach that keeps it in ModelBuilder is this simple model:
My example input data is:
My model is:
Summary stats tool is set up as:
The Calculate field is set up as shown below:
...
4
votes
Multiple values for condition in IIF statement in Arcade
For your arcade expression try something like this:
var veges= ['Carrot','Celery','Broccoli']
IIF( indexof(veges, food ) > -1 , 'Vegetable', 'Fruit')
4
votes
Accepted
Accessing value in specific field of FeatureSet using Arcade
You can get a Feature from a FeatureSet by using the First function. If there are more than one feature in that featureset, you can use the Filter function to make sure you get the specific one you ...
4
votes
Accepted
Using the Arcade Split function to create a list element in ArcGIS Dashboard
I figured it out eventually. May this serve as an illustration to the ArcGIS online help.
When enabling advanced formatting, there is a sample code available. My mistake was to ignore this sample code ...
4
votes
Using arcade in an attribute rule: error "array type expected" (ArcGIS Pro)
Arcade doesn't have all the functionality of Javascript that you're attempting to use in your script
While JS indexOf can take a string, the Arcade IndexOf can only
take an array.
It also doesn't ...
4
votes
Accepted
Arcade equivalent of Python ".zfill"
Looking at Text | Text functions | ArcGIS Arcade | ArcGIS Developers
Text
Text(value, format?) -> Text
The format parameter is where you can specify the number of digits. For example:
var num = ...
4
votes
Accepted
ArcGIS Arcade Pop up expression - How to get a list in the pop up to show colours related to symbology
Use the Arcade element to utilize the html tags necessary to color the different plants (span and style). Note that there is a change in the first loop, which uses the HasKey function instead of ...
3
votes
Finding number of days per ID in table using ArcPy?
If you dont want pandas you can use collections.defaultdict(list) to group ids. Each row is read using da.SearchCursor and stored in a dictionary.
import arcpy
from collections import defaultdict
fc ...
3
votes
Accepted
Using Arcade, AGOL, and Attribute Expressions to Create a Text field with Quotes
You could try using single quotes for the entire string with double quotes in the middle:
'<a href="sample text">sample text</a>'
3
votes
Accepted
How to save the result of an Arcade expression to the database?
Attribute Expressions are just Arcade expressions that run with the JavaScript of the page, and have nothing to do with the actual data. For instance, when a popup loads with an Attribute Expression, ...
3
votes
Arcade expression to find minimum value that is not zero
You are using a coding method called list comprehension which is something that the language Python understands. To the best of my knowledge this technique does not exist in Arcade so you need to ...
3
votes
Dynamic/calculated field in ArcGIS Pro via Arcade expression?
Yes, you can do this is Pro. Right click the layer you want to add an expression to and choose 'Configure Popup'. There is an expression button down the bottom.
3
votes
ArcGIS Arcade Expressions
Following this example
I would recommend modifying your code to return a string with all names like so:
var intersectLayer =Intersects(FeatureSetByName($map,"Origins"), $feature)
var ...
3
votes
Accepted
Decoding Shape using Arcade in ArcGIS Pro
This will show the x and y coordinates (in the layer's coordinate system)
var feat = Geometry($feature);
return feat.x + ", " + feat.y;
3
votes
Arcade Expression for Label Halo Color
I may be wrong but I do not believe Halo is a property you can alter with HTML tags as described in the help file.
What you can do is create classes of labels, each with their particular halo ...
3
votes
Workflow for data expression in Arcade - generate elements from concatenated fields
Your Arcade data expression needs to return a FeatureSet for the Dashboard widget to use. Now that you've loaded your item as a FeatureSet, you'll want to:
Iterate over its features
Perform the ...
3
votes
Accepted
ArcGIS Arcade-Expression - values from several fields
A solution is to use a nested IIF() statement. Imagine the data is this:
Then you would run the following field calculate on it using this scripting logic:
var problemValues = [222,333,444];
var v = ...
3
votes
Accepted
How to find the number of unique values in a field using Arcade expression in ArcGIS Online
The following Arcade code will give you what you want:
// Summarize data into a FeatureSet with two fields, Process and NumProcess
var aFS = GroupBy($layer, 'Process', { name: 'NumProcess', expression:...
3
votes
Arcade expression for FIND using multiple values - getting error for wrong number of arguments
You can use the When() function.
Looking at your values closer makes it seem like this might work as well:
var txt = $feature.ASSETID
var C2 = "71"
var C1 = "72"
var AIR = "73&...
3
votes
How to Activate Hyperlink in Pop-up From Attribute Field
You can use an Arcade element to create a clickable link, using this code:
var output = `Contract Plan: <a href="${$feature.dotcms_factsheet}">Link</a>`
return {
type : '...
3
votes
Accepted
Conditional Image in AGOL Web Map Pop-Up
That's curious. This code works properly in my popup
var output;
if ($feature.PhotoCount > 0) output = '<img src="https://i.postimg.cc/pTzCMSBV/bc-provenance.png" alt="Image"&...
2
votes
Changing colour of point based on null value using Arcade Expression in ArcGIS Online?
I recently had the same issue.
I used
IIF(IsEmpty($feature.ID), "NOT FILLED", "FILLED")
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
arcade × 200arcgis-online × 100
arcgis-pro × 78
symbology × 24
popup × 24
attribute-rules × 21
labeling × 18
expression × 14
arcgis-field-maps × 12
field-calculator × 8
arcgis-desktop × 5
arcgis-portal × 5
operations-dashboard × 5
arcgis-online-webmap × 5
dashboard × 5
geometry × 4
fields-attributes × 4
date × 4
attachments × 4
error-002717 × 4
arcpy × 3
html × 3
domains × 3
feature-service × 3
arcgis-collector × 3