|
POST
|
Can you post your code using the Insert/Edit code sample button? Trying to decipher code in an image is too difficult, especially when attempting to test your code.
... View more
06-13-2025
09:42 AM
|
0
|
0
|
965
|
|
POST
|
Glad to help. Please check the "Accept as Solution" box to help others searching on this problem
... View more
06-13-2025
04:19 AM
|
0
|
0
|
469
|
|
POST
|
There were a couple of things that needed changing. The dates are incorrect if you're portraying 1 July through 30 Sept. In the Date function, months are 0-based, so July is 6, not 7 (lines 5, 6, and 7) The SeasonPerc was a NaN since you were converting the Dates to numbers (lines 5, 6, and 7). The DateDiff function needs Dates as input, not the converted number. DateDiff also returns a number, so there's no need to convert it (lines 9 and 10) SeasonPerc has to be an integer if you're putting it into a integer field (line 11). If it's not converted (and Arcade will not convert it for you), that field attribute will be null. You have to push a dictionary object containing the "attributes" key into the features array (line 15) var ThisYear = Year(Now());
//var ThisMonth = Month(Now());
//var ThisDay = Day(Now())
var startDate = Date(ThisYear, 6, 1);
var endDate = Date(ThisYear, 8, 30);
var currentDate = Date(ThisYear, 6, 25);
var Season = DateDiff(endDate, startDate);
var SeasonSoFar = DateDiff(currentDate, startDate);
var SeasonPerc = Round(Number(SeasonSoFar / Season * 100));
var features = [];
Push(features, { attributes: { DayPercentage: SeasonPerc } });
var PercDict = {
fields: [{ name: "DayPercentage", type: "esriFieldTypeInteger" }],
features: features
};
var features2 = FeatureSet(PercDict);
return features2;
... View more
06-12-2025
12:47 PM
|
0
|
2
|
501
|
|
POST
|
That appears to be the page for 4a1e7bbdef0045599cbf567451bcd2bf
... View more
06-12-2025
12:26 PM
|
0
|
1
|
337
|
|
POST
|
What do you see on the page https://thebluemountains.maps.arcgis.com/home/item.html?id=2a7e2d06a6b34823baef6a367fea0429#overview
... View more
06-12-2025
10:14 AM
|
0
|
3
|
359
|
|
POST
|
Did you try var fs = FeatureSetByPortalItem(Portal('https://thebluemountains.maps.arcgis.com/'), '2a7e2d06a6b34823baef6a367fea0429', 0, ['S_CanConne_', 'S_Reserved', 'S_DesWpro'], false);
... View more
06-12-2025
09:29 AM
|
0
|
5
|
732
|
|
POST
|
Have you tried using 2a7e2d06a6b34823baef6a367fea0429 as the itemId?
... View more
06-12-2025
09:05 AM
|
0
|
7
|
737
|
|
POST
|
Create a key that uses a substitute string if i.NAME is blank (line 9) and use that key for the dictionary (lines 10, 11, and 13). Note that I moved the calculation of out_str outside the for loop. It doesn't need to be calculated for each item in the intersected FeatureSet. var managementareas = FeatureSetByName($map, "ManagmentAreas");
var int_ma = Intersects($feature, managementareas);
var int_dict = {};
var xs = 0;
for (var i in int_ma) {
var xs = AreaGeodetic(Intersection($feature, i), "acres");
var key = iif(IsEmpty(i.NAME), "Empty", i.NAME);
if (HasKey(int_dict, key)) {
int_dict[key] += xs;
} else {
int_dict[key] = xs;
}
}
var out_str = "Management Area Acreage: ";
for (var d in int_dict) {
out_str += "\n" + d + "\t|\t" + Text(int_dict[d], "#,###.#");
}
return out_str;
... View more
06-12-2025
08:10 AM
|
1
|
1
|
510
|
|
POST
|
Since this not a public item, I cannot test it. You'd have to check whether the layer you're using from that service is valid. Put your layer information into a url to see if you can open it. https://thebluemountains.maps.arcgis.com/home/item.html?id=4a1e7bbdef0045599cbf567451bcd2bf&sublayer=0 If that doesn't give you the correct layer, then examine the item's overview page and determine which layer ID you should use.
... View more
06-12-2025
07:42 AM
|
1
|
9
|
748
|
|
POST
|
You have to specify that using the FeatureSetByPortalItem function. var fs = FeatureSetByPortalItem(Portal('yourPortalUrl'), 'yourItemId', 0, ['S_CanConne_', 'S_Reserved', 'S_DesWpro'], false);
var Canc = Sum(fs, "S_CanConne_");
var Reserved = Sum(fs, "S_Reserved");
var DeswPro = Sum(fs, "S_DesWpro");
return FeatureSet(
{
fields: [
{ alias: "Can Connect", name: "CanConnect", type: "esriFieldTypeInteger" },
{ alias: "Reserved", name: "Reserved", type: "esriFieldTypeInteger" },
{ alias: "DeswPro", name: "DeswPro", type: "esriFieldTypeInteger" },
{ alias: "Total", name: "Total", type: "esriFieldTypeInteger" }
],
features: [
{
attributes:
{
CanConnect: CanC,
Reserved: Reserved,
DeswPro: DeswPro,
Total: CanC + Reserved + DeswPro
}
}
]
}
);
... View more
06-11-2025
01:14 PM
|
0
|
11
|
781
|
|
POST
|
First, if you're going to post code, please use the Insert/Edit code sample button. That makes it easier to read the code and copy it to test it. Second, you haven't created the FeatureSet fs to get your sums. Third, a data expression has to return a FeatureSet to be used in a indicator, table, or gauge. To show the total of the sums in an indicator, you could use this return (using the rest of your code) return FeatureSet(
{
fields: [{ alias: "Total", name: "Total", type: "esriFieldTypeInteger" }],
features: [{ attributes: { Total: total } }]
}
); You could create a table with this return return FeatureSet(
{
fields: [
{ alias: "Can Connect", name: "CanConnect", type: "esriFieldTypeInteger" },
{ alias: "Reserved", name: "Reserved", type: "esriFieldTypeInteger" },
{ alias: "DeswPro", name: "DeswPro", type: "esriFieldTypeInteger" },
{ alias: "Total", name: "Total", type: "esriFieldTypeInteger" }
],
features: [
{
attributes:
{
CanConnect: CanC,
Reserved: Reserved,
DeswPro: DeswPro,
Total: total
}
}
]
}
);
... View more
06-11-2025
12:39 PM
|
0
|
13
|
809
|
|
POST
|
What do you get when you return RoadLeft? Your code seems to work in the Playground, returning the value for the IsEmpty check. That is expected, since I doubt the testing FeatureSet and $feature intersect at all The reason you're getting "error0" is that the Geometry function expects a Feature, not a FeatureSet. You'd have to loop through the FeatureSet to test each Feature. var fsNbrhd = FeatureSetByName($datastore, 'Neighborhood', ['Nbrhd_Comm'], true);
for (var f in fsNbrhd) {
if (IsEmpty(Geometry(f))) return `Record ${f.OJBECTID) is empty";
}
return "No empty records"; What's curious is that putting the FeatureSet in the Geometry function works in ArcGIS Pro but not in the Playground. **Update I did test your code using my data in ArcGIS Pro and it did run correctly.
... View more
06-11-2025
07:50 AM
|
3
|
1
|
564
|
|
POST
|
The post you referenced uses that code in a data expression to create a FeatureSet, which is used in the indicator. The profile for this functionality contains the Data access bundle, which includes the Portal and FeatureSet functions. It looks like there's a missing bundle in the documentation, since you can use the FeatureSetByPortalItem function in a data expression also. However, you're using this code in the advanced formatting section, which doesn't include the Data access bundle in its formatting profile.
... View more
06-11-2025
06:16 AM
|
1
|
0
|
1018
|
|
POST
|
You'll want to use an Arcade element instead of a text element to show clickable links. Here's one way to do this, which also uses template literals var p = Portal("https://arcgis.com");
var features = FeatureSetByPortalItem(p, "<feature ID>", 0, ["zone_name", "maintained_yn", "maintained_date", "Maint_Activity", "groups_involved", "notes", "picture"]);
var plot = $feature.Zone_Name;
var filterStatement = "zone_name = @plot";
var relatedData = Filter(features, filterStatement);
var relatedDataSorted = OrderBy(relatedData, "maintained_date ASC");
var popupString = "";
for (var f in relatedDataSorted) {
//var pic = f.picture;
popupString += `${text(f.maintained_date, "MM/DD/YYYY")}<br/>
Native Plant Zone: ${f.zone_name}<br/>
Maintained?: ${f.maintained_yn}<br/>
Maintenance Activity: ${f.Maint_Activity}<br/>
Groups Involved: ${f.groups_involved}<br/>
Notes: ${f.notes}<br/>
<a href="${f.picture}">Photo</a><br/><br/>`
}
return {
type : 'text',
text : popupString
}
... View more
06-10-2025
11:44 AM
|
1
|
1
|
494
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 2 | a month ago | |
| 1 | 11-18-2025 12:30 PM | |
| 2 | 11-18-2025 06:53 AM | |
| 1 | 11-17-2025 06:38 AM |
| Online Status |
Offline
|
| Date Last Visited |
16 hours ago
|