|
POST
|
You can return the layer to make sure it's the correct one (and click Run in the upper left corner instead of Done in the lower right corner in the data expression editor) var layerSites = FeatureSetByPortalItem(p, 'e29449b0af064a5c9222d32e81c64fc1', 15);
return layerSites
... View more
08-21-2024
09:09 AM
|
1
|
6
|
5481
|
|
POST
|
Have you checked whether layerSites is returning the correct layer?
... View more
08-21-2024
08:18 AM
|
0
|
8
|
5484
|
|
POST
|
What you have to do is get the domain's codedValue array and for each item, loop through that array to get the correct domain name. This should work var trees = FeatureSetByName($map, "Trees - Trees");
var countspecies = Intersects(trees, $feature);
var stats = Groupby(countspecies, "commonname",[
{name: "total" ,expression: "commonname", statistic: 'COUNT'}
]);
var topspecies = Top(OrderBy(Filter(stats, "commonname <> ''"), "total desc"), 3);
var result = 'The top species in this tract are:';
var num = 0;
var codedValues = Domain(trees, 'commonname').codedValues;
for (var item in topspecies){
num++;
var num_species = item["total"];
var species_name;
for (var i in codedValues){
if (codedValues[i].code == item['commonname']) species_name = codedValues[i].name;
}
result += TextFormatting.NewLine + num + ". " + " " + species_name + " " + num_species + " " + "planted";
}
return result
... View more
08-21-2024
07:26 AM
|
1
|
0
|
1549
|
|
POST
|
Since your data isn't public, do the fields "IDN" and "SiteType" exist in layerSites?
... View more
08-21-2024
06:12 AM
|
0
|
10
|
5493
|
|
POST
|
It's much more complex in Experience Builder. I believe this is the one you're looking for (in \client\dist\widgets\common\search\src\runtime)
... View more
08-20-2024
01:31 PM
|
0
|
0
|
1808
|
|
POST
|
But the Min function will return a 0 if one of the features has a null value. You'd have to do this to ignore either null or 0 values. **Updated to put the IsEmpty and zero checks at the front of the if statement Expects($feature, 'railroad', 'primary_road', 'secondary_road', 'local_road', 'other_road', 'trail') //field names
var fieldList = ['railroad', 'primary_road', 'secondary_road', 'local_road', 'other_road', 'trail']
var minimum = 99999999;
var minField;
for (var i in fieldList) {
if (!IsEmpty($feature[fieldList[i]]) && $feature[fieldList[i]] != 0 && $feature[fieldList[i]] < minimum) {
minimum = $feature[fieldList[i]]
minField = fieldList[i]
}
}
return minField
... View more
08-20-2024
01:11 PM
|
0
|
1
|
2526
|
|
POST
|
Here's one way to do it. The variable fieldList (and Expects) contains the names of the fields you are comparing . Expects($feature, 'railroad', 'primary_road', 'secondary_road', 'local_road', 'other_road', 'trail') //field names
var fieldList = ['railroad', 'primary_road', 'secondary_road', 'local_road', 'other_road', 'trail']
var minimum = 99999999;
var minField;
for (var i in fieldList) {
if ($feature[fieldList[i]] < minimum) {
minimum = $feature[fieldList[i]]
minField = fieldList[i]
}
}
return minField
... View more
08-20-2024
12:25 PM
|
0
|
3
|
2538
|
|
POST
|
The reason you're not getting any results for a name less than four words is that you're using specific index values in the split array that wouldn't exist in lines 4 and 6 for shorter words. This should work regardless of the number of words in the name. The third line will contain anything more than four words. Var FtName = $feature['Name'];
var FtSplit = Split(FtName, ' ')
Var Counter = Count(FtSplit)
When (Counter < 4, FtName,
Counter == 4, Concatenate(Slice(Ftsplit,0, 2), ' ') + TextFormatting.NewLine + Concatenate(Slice(FtSplit, 2, 4), ' '),
Concatenate(Slice(Ftsplit,0, 2), ' ') + TextFormatting.NewLine + Concatenate(Slice(FtSplit, 2, 4), ' ') + TextFormatting.NewLine + Concatenate(Slice(FtSplit, 4), ' ')
);
... View more
08-20-2024
10:43 AM
|
2
|
0
|
2809
|
|
POST
|
When asking a question about code, you should insert the code using the "Insert/edit code sample" button instead of posting an image of the code. It makes it easier to duplicate it in our testing environments.
... View more
08-20-2024
09:53 AM
|
1
|
0
|
2831
|
|
POST
|
It looks like there are a couple of things wrong with this code. NearestCoordinate takes a single feature as the first parameter, but you're providing a FeatureSet. You'd have to get a single feature from zip as the first parameter. It takes a point as its second parameter, not a polygon (the result of a Buffer function). Finally, the return contains the property sideOfLine, not left or right. Your code would look something like this: var zip = First(FeatureSetByName($datastore, "Transportation.xyzx.ZipCodeVW", ["ZIPCODE"])); //or you could filter the featureset for a specific zip and get the first item from that
var Result = NearestCoordinate(zip, $feature);
return Result.sideOfLine
... View more
08-19-2024
08:08 AM
|
0
|
0
|
1830
|
|
POST
|
I've used the ArcGIS Assistant to do this. I used the Save as Copy option, then opened the copy in Assistant to change the url of the configured layer. Read the user guide for more information about this tool.
... View more
08-15-2024
07:02 AM
|
0
|
0
|
2528
|
|
POST
|
I left missed the closing parenthesis for the GPS text. Since I can't edit my post, it's updated here IIf (IsEmpty($feature.GPS),
`${$feature.Site}: ${$feature.Latitude}, ${$feature.Longitude}`,
`${$feature.Site} (${$feature.GPS}): ${$feature.Latitude}, ${$feature.Longitude}`
)
... View more
08-14-2024
11:52 AM
|
1
|
1
|
1434
|
|
POST
|
You can do that this way. This uses an implicit return and template literals IIf (IsEmpty($feature.GPS),
`${$feature.Site}: ${$feature.Latitude}, ${$feature.Longitude}`,
`${$feature.Site} (${$feature.GPS}: ${$feature.Latitude}, ${$feature.Longitude}`
)
... View more
08-14-2024
11:50 AM
|
1
|
2
|
1435
|
| 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
|