|
POST
|
This idea is over four years old and a major version ago. It's still at the "Open" status. Are there any indications it's ever going to be moved into the "Under Consideration" status? Could it make in into ArcGIS Pro 4.x?
... View more
03-18-2026
10:47 AM
|
0
|
1
|
332
|
|
POST
|
What are the symbol classes that are being returned? Do you have values in ASSETTYPE and ownedby that will return all possible classes? Arcade will not create a symbol for a value that isn't in the attributes. For example, if you don't have any ASSETTYPE == 30, the legend will not have the classes from lines 6 or 7. When I create a legend from an Arcade script, I'll put in dummy values in the attributes to get all the possible combinations, then remove them after running the script. This is another way to write your script var x2 = $feature.ASSETTYPE;
var z2 = $feature.ownedby;
var x = iif(x2 >= 7 && x2 <= 10, "Plastic", DomainName($feature, 'ASSETTYPE'));
return iif(z2 == 30, DomainName($feature, 'ownedby') + " " + x, x);
... View more
03-18-2026
06:57 AM
|
0
|
0
|
155
|
|
POST
|
My apologies. I forgot to add a wildcard in the sqlExpression. Here's the tested code that works var fs = FeatureSetByName($datastore, "GIS_Miway_LandingPad");
var string = `${$feature.StopID_text}-LP-`
var sql = `${string}%`;
var filtered = Filter(fs, "AssetID LIKE @sql");
if (Count(filtered) == 0) return `${string}1`;
var list = [];
for (var f in filtered) {
Push(list, f["AssetID"]);
}
function reverseSort(a, b) {
if (a < b) return 1;
if (a > b) return -1;
return 0;
}
var highest = Sort(list, reverseSort)[0]
return `${string}${Number(Split(highest, "-LP-")[1]) + 1}` In my test data, I used the Habitat field
... View more
03-13-2026
09:50 AM
|
3
|
1
|
774
|
|
POST
|
When posting code, use the "Insert/Edit code sample" button. The syntax is incorrect on the Filter's sqlExpression var filtered = Filter(fs, "AssetID LIKE @sql");
... View more
03-13-2026
06:03 AM
|
0
|
3
|
793
|
|
POST
|
I was looking at it another way, incrementing the counter for the unique values of `${$feature.Field1}-BB-` I haven't tested it, but was thinking along these lines var fs = FeatureSetByName($datastore, "yourLayer");
var sql = `${$feature.Field1}-BB-`;
var filtered = Filter(fs, "Field2 LIKE @sql");
if (Count(filtered) == 0) return `${$feature.Field1}-BB-1`;
var list = [];
for (var f in filtered) {
Push(list, f["Field2"]);
}
function reverseSort(a, b) {
if (a < b) return 1;
if (a > b) return -1;
return 0;
}
var highest = Sort(list, reverseSort)[0]
return `${$feature.Field1}-BB-${Number(Split(highest, "-BB-")[1])+ 1}` In line 3, the FeatureSet is filtered to only show the existing values for that field. If there aren't any, it returns the string with the counter = 1 in line 4. Lines 6-9 create a list of the values in Field2. Lines 11-15 are a reverse sorting function (taken from the Sort example) to get the highest value in line 17. Line 18 returns the string and the highest value incremented by one.
... View more
03-12-2026
08:19 AM
|
2
|
1
|
847
|
|
POST
|
This would return the first seven characters attrs["Category"] = Left(f["Type"], 7);
... View more
03-09-2026
10:09 AM
|
0
|
0
|
352
|
|
POST
|
How would you determine which 25 tracts to use? Is your dataset only those 25 tracts?
... View more
03-09-2026
07:27 AM
|
0
|
0
|
153
|
|
POST
|
Here's one way to create that new field. This takes the Schema of your original FeatureSet (line 9) and adds the additional field "Category" (line 10). It creates a dictionary for a new FeatureSet (lines 12-16), then loops through the records in the original Featureset (line 17) and copying all the attributes (lines 20-22). For the new "Category" field, it takes the value from the "Type" attribute, splits it into an array, and extracts the text before the colon (line 23). The attributes are added into a new feature (line 25) and a new FeatureSet is created from the dictionary (line 27). var fs = FeatureSetByPortalItem(
Portal("yourPortal"),
"yourItem",
0,
["*"],
false
);
var theSchema = Schema(fs);
Push(theSchema.fields, { name: "Category", type: "esriFieldTypeString" });
//return theSchema;
var temp_dict = {
fields: theSchema["fields"],
geometryType: Schema(fs).geometryType,
features: []
};
for (var f in fs) {
var attrs = {};
for (var attr in f) {
attrs[attr] = f[attr];
}
attrs["Category"] = Split(f["Type"], ":")[0];
Push(temp_dict["features"], { attributes: attrs, geometry: Geometry(f) });
}
return Featureset(temp_dict);
... View more
03-09-2026
07:18 AM
|
0
|
2
|
367
|
|
POST
|
In my experience, the text environment uses the first item, whether its a feature or pixel. I'm guessing the first "pixel" is null but all the others will return a valid response. I would also get the execution error when running it there. However, as shown in the image, I do see what the keys are in the $pixel dictionary. The reason I was using "Raster.ItemPixelValue" was that it's shaded relief image. The "Raster.ServicePixelValue" key returned an array like ["69","176","45"], representing the red, green, and blue values.
... View more
03-04-2026
11:25 AM
|
1
|
0
|
512
|
|
POST
|
I was using this image service. Also, when using an Arcade element, you have to return a dictionary return {
type : 'text',
text : `Pixel Value: ${Number($pixel["Raster.ItemPixelValue"][0])}`
}
... View more
03-04-2026
10:54 AM
|
0
|
2
|
518
|
|
POST
|
This code works in my popup. I get an error in the console when running it, because everything in $pixel is null in the test environment, but it does have values in the popup
... View more
03-04-2026
10:18 AM
|
0
|
5
|
525
|
|
POST
|
From the way I read it, your code would only return two items. Take a look at the second example in the documentation: Your track has a field named Speed with sequentially ordered values of [10, 20, 30, 40, 50]. The geometries of the features are [{x: 1, y: 1},{x: 2, y: 2} ,{x: null, y: null},{x: 4, y: 4}, {x: 5, y: 5}]. The expression is evaluated at each feature in the track. For this example, we examine results when evaluated at the third feature (30). Results are returned inclusive of the start feature, and exclusive of the end feature. var window = TrackFieldWindow('Speed', -2,2)window;// returns [10,20,30,40] What happens when you use this syntax? // Get last 3 speed observations
var speeds = TrackFieldWindow("speedInMph", -2, 1);
// Check that all 3 speeds are > 25 MPH
return
Count(speeds) >= 3 &&
speeds[0] > 25 &&
speeds[1] > 25 &&
speeds[2] > 25;
... View more
03-03-2026
11:14 AM
|
0
|
0
|
239
|
|
POST
|
Use the Console function to test whether you're getting back any results from the Filter function. Also, is the field "no_proj" a string field or numeric field? You can use variable substitution in the Filter function to avoid the quote problem function RecupererNoProjet(np_1) {
var EntreesDansProjet = Filter(numberlist, "no_proj = @NP_1");
Console(Count(EntreesDansProjet));
var max_feature = First(OrderBy(EntreesDansProjet, "id_table DESC"));
if (max_feature.id_table != null) {
return max_feature.id_table;
}
return 0;
}
... View more
03-03-2026
06:05 AM
|
0
|
0
|
255
|
|
POST
|
If you'd like to keep the order of the fields, you can use the feature's Schema instead. Expects($feature, "*");
var fields = Schema($feature)["fields"];
var fieldInfos = [];
for (var field of fields) {
if (!IsEmpty($feature[field.name])) {
var fInfo = {fieldName: field.name}
Push(fieldInfos, fInfo)
}
}
return {
type: "fields",
fieldInfos: fieldInfos
};
... View more
02-25-2026
10:21 AM
|
5
|
0
|
276
|
|
POST
|
I created the Sampling Design Tool add-in for doing more complex sampling. Take a look at its documentation to see if it has the capability to do what you're wanting.
... View more
02-25-2026
05:45 AM
|
0
|
0
|
307
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | Friday | |
| 1 | 4 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 10-11-2023 06:18 AM | |
| 1 | 03-23-2026 09:23 AM |
| Online Status |
Online
|
| Date Last Visited |
8 hours ago
|