|
POST
|
In the Indicator tab, turn off the Unit prefix option
... View more
11-14-2025
05:50 AM
|
3
|
0
|
359
|
|
POST
|
OK, this should give you what you're trying to do, but I haven't tested it. It loops through each tract, gets the intersecting lakes for that tract, then gets the intersecting area for each lake. Then it gets the total lake count. Note that the area is rounded to two decimal places. It will take a while to process. You could test whether "Memorizing" the tracts and lakes layers makes it any faster. var port = Portal("https://www.arcgis.com");
// Load layers
var tracts = FeatureSetByPortalItem(port, "b9fcbedac0384e32bc3dba6aec1a8cf6", 0);
var lakes = FeatureSetByPortalItem(port, "5564b2e702364aefba08df8c95216a1f", 0, ["OrgKeyID"]);
var lakesfilt = Filter(lakes, "OrgKeyID > 0");
var totalAcres = 0;
var arrTracts = [];
for (var tract in tracts) {
var intersectingLakes = Intersects(lakesfilt, tract);
Push(arrTracts, tract);
for (var intersectingLake in intersectingLakes) {
var lakePart = Intersection(tract, intersectingLake);
totalAcres += Area(lakePart, "acres");
}
}
var lakeCount = Count(Intersects(lakesfilt, Union(arrTracts)))
return FeatureSet(
{
fields: [
{ name: "LakeCount", type: "esriFieldTypeInteger" },
{ name: "Acres", type: "esriFieldTypeDouble" }
],
features: [
{ attributes: { LakeCount: lakeCount, Acres: Round(totalAcres, 2) } }
]
}
);
... View more
11-13-2025
01:27 PM
|
1
|
1
|
509
|
|
POST
|
I guess I'm not clear on the number you're expecting to get for the total area. Do you want to sum up the area of the portion of each lake that intersect the each tract? If so, then you'll have to loop through each tract and each lake to get the Intersection geometry and add its area to the total. However, the total count of the lakes will likely be incorrect, since a lake intersecting several tracts will be counted for each tract.
... View more
11-13-2025
12:59 PM
|
0
|
3
|
514
|
|
POST
|
You have the order of the DateDiff parameters reversed if the ExpDate is in the future. For those dates, your expression returns a negative number. Here's an easier way to write your expression, using the When function. This assumes that the ExpDate field is a date field. if (IsEmpty($feature.Expdate) return "Expiry Date Unavailable"
var diff = DateDiff($feature.Expdate, Now(), "days");
When(diff <= 0, "Expired",
diff <= 30, "Expires within 30 days",
diff < 100, "Expires between 30 to 100 days",
"Expires in more than 100 days"
);
... View more
11-13-2025
10:44 AM
|
1
|
0
|
251
|
|
POST
|
I've tested the code using some of my own data and it returned the expected data. I did make a change to line 17 to use the field type "esriFieldTypeInteger" since Count returns an integer, but keeping it as it is also works. The next step would be to put some debugging Console messages in the code at various places (like before and after line 11) and click the Run button in the editor window. This will give you a better idea where the code is crashing.
... View more
11-13-2025
08:52 AM
|
0
|
0
|
531
|
|
POST
|
Doing lots of intersects is a resource hog, since the code has to make external calls for each feature in the loop. @jcarlson wrote a good post about how to store the features in memory (using his Memorize function) to speed up this process. This would be good if you wanted to create a table showing how many lakes are in each tract. However, since you're looking to just get the sum off all the lakes in all the tracts, you can loop through the tracts FeatureSet to union them into a single feature, then use that feature in your Intersects function. You can get the count of that FeatureSet to see how many lakes there are and use the Area function to get the total area of all the lakes. var port = Portal("https://www.arcgis.com");
// Load layers with correct area field name
var tracts = FeatureSetByPortalItem(port, "b9fcbedac0384e32bc3dba6aec1a8cf6", 0, ["OBJECTID"], true);
var lakes = FeatureSetByPortalItem(port, "5564b2e702364aefba08df8c95216a1f", 0, ["OBJECTID"], true);
var arrTracts = [];
for (var tract in tracts) {
Push(arrTracts, tract);
}
var lakesFS = Intersects(lakes, Union(arrTracts));
return FeatureSet(
{
fields: [
{ name: "LakeCount", type: "esriFieldTypeSingle" },
{ name: "Acres", type: "esriFieldTypeDouble" }
],
features: [
{
attributes:
{
LakeCount: Count(lakesFS),
Acres: Area(lakesFS, "acres")
}
}
]
}
);
... View more
11-11-2025
02:03 PM
|
0
|
2
|
604
|
|
POST
|
You should start a new discussion when asking a question like this. Also, when posting code, use the "Insert/Edit code sample" button. It makes it easier to read and refer to specific lines. There are several problems in this line. var countLakes = Count(Filter(lakes, Intersects(Geometry(lakes), tractGeom))); You don't need to filter the results of the Intersects function and even if you did need it, you weren't providing the required sqlExpression. The Geometry function takes a feature as an input instead of a FeatureSet. And in the previous line, you don't need to cast t as a Geometry. Try this instead var countLakes = Count(Intersects(lakes, t));
... View more
11-11-2025
09:32 AM
|
1
|
0
|
358
|
|
POST
|
You can use the SQL CASE statement in the first GroupBy to bin the ages. This will also calculate the age group for the current year instead of 2025. The second GroupBy will count the number of each of the age groups var fs = FeatureSetByPortalItem(
Portal('https://www.arcgis.com/'),
'123456', 0,
['year_of_birth_please_write_full'],
false
);
var sql =
`Case
When year_of_birth_please_write_full > ${Year(Now()) - 18} Then '<18'
When year_of_birth_please_write_full > ${Year(Now()) - 30} Then '18-30'
When year_of_birth_please_write_full > ${Year(Now()) - 40} Then '31-40'
When year_of_birth_please_write_full > ${Year(Now()) - 50} Then '41-50'
When year_of_birth_please_write_full > ${Year(Now()) - 60} Then '51-60'
else '>60'
end`
;
var grouped = GroupBy(
fs,
'OBJECTID', // unique ID field
{ name: 'Age_years', expression: sql, statistic: 'MAX' }
);
GroupBy(
grouped,
"Age_years",
{ name: "Age_Groups", expression: "1", statistic: "COUNT" }
);
... View more
11-06-2025
09:22 AM
|
0
|
1
|
377
|
|
POST
|
Glad to help. Don't forget to click the "Accept as Solution" button to help others searching for this answer.
... View more
11-05-2025
08:42 AM
|
0
|
0
|
230
|
|
POST
|
Try using the escape character "}" for "{" and "}" for "}". This syntax seems to work var output = `https://clientURL/?search={[Property Card]:[Sec_Block_Lot] = "77-3-34"}&openlfoneresult=true`
return {
type : 'text',
text : output
}
... View more
11-04-2025
03:26 PM
|
1
|
2
|
274
|
|
POST
|
You can convert it like this var geom = Geometry($feature);
if (IsEmpty(geom)) {
return null;
} else {
return geom.Z * 3.28084;
} An even simpler expression would be var geom = Geometry($feature);
IIf(IsEmpty(geom), null, geom.Z * 3.28084);
... View more
11-04-2025
07:10 AM
|
5
|
0
|
197
|
|
POST
|
Labels in web maps aren't able to render the formatting tags with Arcade. I think the only solution would be to set up a label class for each of the different colors used in your labels.
... View more
10-28-2025
02:07 PM
|
0
|
0
|
259
|
|
POST
|
The first rule of data expressions is they have to return a FeatureSet. Your expression is only returning a number, so the easiest way to make that into a FeatureSet would be using this syntax for the return return FeatureSet(
{
fields: [{ name: "Total", type: "esriFieldTypeSingle" }],
features: [{ attributes: { Total: Round(total_promedio, 2) } }]
}
);
... View more
10-28-2025
01:21 PM
|
0
|
0
|
220
|
|
POST
|
"yourField" is the name of the date field in your layer. "DESC" just means to sort the attributes in that field in descending order. Please refer to the OrderBy function documentation
... View more
10-20-2025
05:55 AM
|
1
|
0
|
186
|
|
POST
|
The section of the code "$dataSources('dataSource_1')" will give you the FeatureSet, but then you have to do some additional things to get the latest date. You would then have to sort the FeatureSet by the date field (line 2), get the first feature (line 3), then pass the attribute from the date field into the text expression (line 4). That would look something like this, if "yourField" is the name of the date field. var fs = $dataSources("dataSource_1");
var sorted = OrderBy(fs, "yourField DESC");
var feat = First(sorted);
return "Last date update: " + Text(feat.yourField, "MM.DD.YYYY");
... View more
10-16-2025
09:33 AM
|
0
|
2
|
250
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a week ago | |
| 2 | a week 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 |
Tuesday
|