|
POST
|
It doesn't matter if you have the layer within a group layer. This works on a test I set up. var fs = FeatureSetByName($map, "USA Census States")
var output = Within($feature,FS)
return {
type : 'text',
text : first(output).STATE_NAME
} Did you test the code on an actual feature in the Zoning District? Running the code in the editor will use the first feature in the FeatureSet, which may or may not give you a feature within the Zoning District layer. You can use a feature you know will work by filtering the parcel to a specific one. In my example, I can filter the earthquakes to a specific event to test it out. This code var feat = First(Filter($layer, "id = 'mb90114598'"))
var fs = FeatureSetByName($map, "USA Census States")
var output = Within(feat,FS)
return output
return {
type : 'text',
text : first(output).STATE_NAME
} returns this The code in your latest post fails because you're supplying an incorrect name for the FeatureSetByName function, which returns a null. When used in the WIthin function, it's being interpreted as a null feature in the Geometry Within function (which returns a boolean) instead of the FeatureSet Within function (which returns a FeatureSet)
... View more
10-06-2025
04:19 PM
|
0
|
5
|
313
|
|
POST
|
What is the actual text in the $feature.Introduction?
... View more
10-06-2025
02:59 PM
|
0
|
1
|
196
|
|
POST
|
You can see all the icons on the Calcite Design System's Icon page
... View more
10-01-2025
06:59 AM
|
0
|
1
|
230
|
|
POST
|
Lines 20 tests whether a relationship exists, not whether there are records in the relationship. The code fails when you try to access a field from a null in line 22 You'll have to test whether that relationship has any records. if (Count(related_site) > 0) {
... View more
09-30-2025
07:38 AM
|
1
|
0
|
208
|
|
POST
|
Chrome (140.0.7339.186) and Firefox (143.0.1) work, but Edge (140.0.3485.81) doesn't for me.
... View more
09-25-2025
08:09 AM
|
0
|
0
|
193
|
|
POST
|
Here's one way to calculate the difference (this shows the number of days since the beginning of the year). Note that the month number in the Date function is 0-based (0 is January) function StringToDate(input) {
var arrDate = Split(input, "/");
return Date(arrDate[2], arrDate[1] - 1, arrDate[0]);
}
var date1 = "01/01/2025";
var date2 = Text(Now(), "DD/MM/Y"); //gives today's date as dd/mm/yyyy
Floor(DateDiff(StringToDate(date2), StringToDate(date1), "days")); If your goal is to put this number into an indicator, then you have to return a FeatureSet containing that number function StringToDate(input) {
var arrDate = Split(input, "/");
return Date(arrDate[2], arrDate[1] - 1, arrDate[0]);
}
var date1 = "01/01/2025";
var date2 = Text(Now(), "DD/MM/Y"); //gives today's date as dd/mm/yyyy
var days = Floor(DateDiff(StringToDate(date2), StringToDate(date1), "days"));
return FeatureSet(
{
fields: [{ name: "Days", type: "esriFieldTypeInteger" }],
features: [{ attributes: { Days: days } }]
}
);
... View more
09-24-2025
01:00 PM
|
0
|
0
|
252
|
|
POST
|
First, check all the field names. I may have overlooked changing one back to your schema. Click the Run button in the Arcade editor to see if it's returning a FeatureSet. Add some Console messages to see what the code is doing a various intervals. This should help you figure out what's going wrong.
... View more
09-24-2025
07:55 AM
|
0
|
2
|
327
|
|
POST
|
It looks like it's selective. I still get the error.
... View more
09-23-2025
10:34 AM
|
0
|
0
|
613
|
|
POST
|
That code should be var features = FeatureSetByName($map, 'Kartirane geoloske jedinice', ['PreferisanaStarost'], true);
Distinct(features, 'PreferisanaStarost');
... View more
09-23-2025
09:52 AM
|
0
|
0
|
203
|
|
POST
|
When posting code, please use the "Insert/edit code sample" button. It's easier to read and copy the code. A data expression must return a FeatureSet. Your code just returns an array of text strings. // Portal URL
var portalURL = "https://gis.(COMPANY_NAME).com/portal";
// Feature Layer ItemID
var layerItemID = "itemID";
// Layer index (usually 0)
var layerIndex = 0;
// Fields to include
var fields = ["T4PERMIT", "COMMODITY1", "OD", "Length_Miles"];
// Get FeatureSet from portal item
var fs = FeatureSetByPortalItem(
Portal(portalURL),
layerItemID,
layerIndex,
fields,
false
);
var grouped = GroupBy(
fs,
["T4PERMIT", "COMMODITY1", "OD"],
[{ name: "TotalMileage", expression: "Length_Miles", statistic: "SUM" }]
);
var finalResults = [];
for (var permit in Distinct(grouped, "T4PERMIT")) {
var permitVal = permit["T4PERMIT"];
var permitGroup = Filter(grouped, "T4PERMIT = @permitVal");
var textBlock = "<b>T4 Permit:</b> " + permitVal + "<br>";
for (var comm in Distinct(permitGroup, "COMMODITY1")) {
var commVal = comm["COMMODITY1"];
textBlock += " • <b>Commodity:</b> " + commVal + "<br>";
var commGroup = Filter(permitGroup, "COMMODITY1 = @commVal");
for (var row in commGroup) {
textBlock += "  ◦ <b>OD:</b> " +
row["OD"] +
" – <b>Mileage:</b> " +
Round(row["TotalMileage"], 2) +
"<br>";
}
}
Push(finalResults, { attributes: { Permits: textBlock } });
}
return FeatureSet(
{
fields: [{ name: "Permits", type: "esriFieldTypeString" }],
features: finalResults
}
); Using my test data, the code produces this list
... View more
09-23-2025
08:38 AM
|
1
|
5
|
586
|
|
POST
|
This goes back to my previous post How you get the features variable depends on where you're using the Arcade code. It could be using the variable $datastore or $layer. Or you might need to get it from a function like FeatureSetByName or FeatureSetByPortalItem What happens when you use "$datastore"?
... View more
09-23-2025
08:16 AM
|
0
|
0
|
209
|
|
POST
|
The Distinct function for FeatureSets has the syntax Distinct(features, fields) with the "features" variable being a FeatureSet and the "fields" variable being either a single field name or an array of field names. How you get the features variable depends on where you're using the Arcade code. It could be using the variable $datastore or $layer. Or you might need to get it from a function like FeatureSetByName or FeatureSetByPortalItem What do you get if you use this in your code? Distinct($layer, "Peferisana starost")
... View more
09-19-2025
09:48 AM
|
0
|
0
|
920
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 2 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 3 weeks ago |
| Online Status |
Offline
|
| Date Last Visited |
Friday
|