|
POST
|
One way to avoid duplicate names to use an array to store the names. For each record, the code checks whether the name already exists in the array before adding it. Then it uses the Concatenate function to combine all the items in the array into a comma-separated string. var feat = FeatureSetByName($map, "Layer1", ["AREA_NAME"]);
var intersectFeat = Intersects(feat, Buffer($feature, 1));
var arr = [];
for (var x in intersectFeat) {
var feat_name = DomainName(x, "AREA_NAME");
if (!Includes(arr, feat_name)) Push(arr, feat_name);
}
return Concatenate(arr, ", ");
... View more
09-17-2024
07:42 AM
|
1
|
1
|
1593
|
|
POST
|
This code will check if the Feature or FeatureSet contains a field. function fieldExists(item, fieldName) { //item can be a Feature or FeatureSet
var fields = Schema(item).fields;
for (var i in fields) {
if (Lower(fields[i].name) == Lower(fieldName)) return true;
}
return false;
}
iif(fieldExists($feature, "field_name"), "Field Exists", "Field doesn't exist");
... View more
09-17-2024
05:42 AM
|
0
|
0
|
1522
|
|
IDEA
|
There are a number of good blog posts on how to customize your popup, including Pop-ups: the essentials A fresh new look for pop-ups Pop-ups: Arcade essentials Part 1: Introducing Arcade pop-up content elements Part 2: Introducing Arcade pop-up content elements
... View more
09-13-2024
07:13 AM
|
0
|
0
|
4315
|
|
IDEA
|
I was testing this on ArcGIS Pro 3.3.0, so maybe this was fixed from your version.
... View more
09-12-2024
02:03 PM
|
0
|
0
|
2300
|
|
IDEA
|
You can add in just the table using the URL. Your mistake is using the table name instead of its layer ID. For example, I have a service set up on AGOL with a spatial layer and several tables. To add the Source table to ArcGIS Pro, I use id "1", not "Source" and the table is added to my project
... View more
09-12-2024
01:41 PM
|
0
|
0
|
2312
|
|
POST
|
You can add the items to an array and use the Concatenate function. This wouldn't add an extra comma if there is only one result. var land = FeatureSetByName($datastore, "Boundary_Aug2024", ["Name"], true);
var intersectLayer = Intersects(land, Geometry($feature));
var result = [];
if (Count(intersectLayer) == 0) return "Null";
for (var layer in intersectLayer) {
Push(result, layer.Name);
}
return Concatenate(result, ", ");
... View more
09-12-2024
10:24 AM
|
6
|
1
|
1951
|
|
POST
|
In the Visible expression, this should display the field only when the date in the Date field is older than 30 days from today (and the Date field isn't empty) iif(IsEmpty($feature.theDateField), false, DateDiff(Now(), $feature.theDateField, 'days') > 30)
... View more
09-12-2024
07:35 AM
|
0
|
0
|
824
|
|
POST
|
Esri has two closed bug reports and an enhancement request related to this, as noted in this post BUG-000152604: In Map Viewer, the Arcade $feature global variable returns fields alphabetically instead of the default field order it is published as. Closed, will not be addressed: Public Explanation: This issue is not addressed at this time as it is a breaking change to existing expressions. ENH-000140303: Add a functionality to the map viewer to resort a field list based on the layer field or alphabetical order. BUG-000144733: ArcGIS Online Map Viewer does not honor the field order for a hosted feature service. Closed: Known limitation Public Explanation: This is currently working as designed in the ArcGIS Online Map Viewer. There is a road map plan to add additional sort options to this field experience to take default order into account.
... View more
09-12-2024
06:43 AM
|
0
|
0
|
931
|
|
POST
|
Glad to help. Don't forget to click the "Accept as Solution" button to the post(s) that answered your question.
... View more
09-10-2024
12:41 PM
|
0
|
0
|
1870
|
|
POST
|
The Contains function will return the list of features that are completely within the feature, which won't happen with most of the flood zones. Instead, you'll want to use the Intersects function. var FLDZN = Intersects(FeatureSetByName($map, "Flood Hazard Area"), $feature);
var FLDZN_list = [];
for (var f in FLDZN) {
if (!Includes(FLDZN_list, f.FLD_ZONE)) Push(FLDZN_list, f.FLD_ZONE);
}
return {
type: "text",
text: Concatenate(FLDZN_list, "<br/>")
}; BTW, if you include code in your messages, you should use the "Insert/Edit code sample" button.
... View more
09-10-2024
10:22 AM
|
0
|
2
|
1885
|
|
POST
|
I was using a field name in my data (Captureaction), but you must use your field name (OFFICIAL_N). Can you send it to me through Messages?
... View more
09-10-2024
06:53 AM
|
0
|
4
|
1921
|
|
POST
|
Your code works in testing (using an Arcade element) on my data. I've added the extra check so there aren't any duplicates var FLDZN = Contains($feature,FeatureSetByName($map,"Buildings"))
var FLDZN_list = []
for (var f in FLDZN){
if (!Includes(FLDZN_list, f.Captureaction)) Push(FLDZN_list, f.Captureaction)
}
return {
type : 'text',
text : Concatenate(FLDZN_list, '<br/>')
}
... View more
09-10-2024
05:48 AM
|
0
|
6
|
1929
|
|
POST
|
There are closed bugs and enhancement requests for these quirks BUG-000152604: In Map Viewer, the Arcade $feature global variable returns fields alphabetically instead of the default field order it is published as. Closed, will not be addressed: Public Explanation: This issue is not addressed at this time as it is a breaking change to existing expressions. ENH-000140303: Add a functionality to the map viewer to resort a field list based on the layer field or alphabetical order. BUG-000144733: ArcGIS Online Map Viewer does not honor the field order for a hosted feature service. Closed: Known limitation Public Explanation: This is currently working as designed in the ArcGIS Online Map Viewer. There is a road map plan to add additional sort options to this field experience to take default order into account.
... View more
09-10-2024
05:31 AM
|
0
|
0
|
1256
|
|
POST
|
You can use the "Like" operator in the sql statement filter(fs, "FUNDING_SOURCE Like '%State%'")
... View more
09-09-2024
01:33 PM
|
0
|
1
|
3977
|
|
POST
|
If you know there should be related records, the next step would be to make sure the field name is correct in the Filter statement
... View more
09-09-2024
11:31 AM
|
0
|
0
|
2347
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-04-2025 06:39 AM | |
| 1 | 05-01-2026 08:26 AM | |
| 1 | 04-10-2026 12:01 PM | |
| 1 | 04-13-2026 09:11 AM | |
| 1 | 10-11-2023 06:18 AM |
| Online Status |
Offline
|
| Date Last Visited |
Thursday
|