POST
|
You'd have to use this. for (var pnt in pt_fs) {
var in_fire = [];
var in_event = [];
var has_fire = Within(pnt, fire_poly);
var has_weather = Within(pnt, weather_poly);
Console("Outer for loop iterating.");
if (has_fire || has_weather) {
Console("First conditional passed."); I was testing on some public data and got it to work var portal = Portal("https://www.arcgis.com");
var fire_poly = FeatureSetByPortalItem(
portal,
"d957997ccee7408287a963600a77f61f",
1,
["IncidentName"],
true
);
var weather_poly = FeatureSetByPortalItem(
portal,
"a6134ae01aad44c499d12feec782b386",
6,
["Event", "Severity"],
true
);
var pt_fs = Top(FeatureSetByPortalItem(
portal,
"9e2f2b544c954fda9cd13b7f3e6eebce",
0,
["*"],
true
), 80);
var features = [];
var feat;
for (var pnt in pt_fs) {
var in_fire = [];
var in_event = [];
if (Count(Within(pnt, fire_poly)) > 0 || Count(Within(pnt, weather_poly)) > 0) {
for (var poly in fire_poly) {
if (Within(pnt, poly)) {
Push(in_fire, poly["IncidentName"]);
}
}
for (var poly in weather_poly) {
if (Within(pnt, poly)) {
Push(in_event, poly["Severity"] + " " + poly["Event"]);
}
}
console(pnt)
feat = {
attributes:
{
SAP_EQUIP: pnt["place"],
fire: IIf(IsEmpty(First(in_fire)), "N/A", Concatenate(in_fire, ", ")),
weather_event:
IIf(IsEmpty(First(in_event)), "N/A", Concatenate(in_event, ", "))
}
};
Push(features, feat);
}
}
var out_dict = {
fields: [
{ name: "SAP_EQUIP", alias: "SAP Equipment ID", type: "esriFieldTypeString" },
{ name: "fire", alias: "Name of Fire", type: "esriFieldTypeString" },
{
name: "weather_event",
alias: "Weather Event",
type: "esriFieldTypeString"
}
],
geometryType: "",
features: features
};
return FeatureSet(out_dict);
... View more
3 hours ago
|
0
|
2
|
28
|
POST
|
You can use Console to test out where the script is breaking. If I have a problem with the script, I sprinkle them throughout to find the problem line. As it turns out, I was incorrect for lines 48 and 54. I was mixing up the Withins. The one on line 46 is a FeatureSet Within and doesn't return a Boolean, while the other two are Geometry Withins which do return a Boolean. for (var poly in fire_poly) {
if (Within(pnt, poly)) {
Push(in_fire, poly["IncidentName"]);
}
}
for (var poly in weather_poly) {
if (Within(pnt, poly)) {
Push(in_event, poly["Severity"] + " " + poly["Event"]);
}
}
... View more
4 hours ago
|
0
|
4
|
59
|
POST
|
I was looking at the FeatureSet Within instead of the Feature Within. Still, when I ran a test on the Feature Within, it returns a FeatureSet. I misplaced a parenthesis in the second Count. Try this instead. if (Count(Within(pnt, fire_poly)) > 0 || Count(Within(pnt, weather_poly)) > 0) {
... View more
5 hours ago
|
0
|
7
|
70
|
POST
|
Your problem is on line 46 (as well as 48 and 54). Within returns a FeatureSet, which can't be directly evaluated in an if statement. You have to return some sort of boolean, such as if (Count(Within(pnt, fire_poly)) > 0 || Count(Within(pnt, weather_poly) > 0)) {
... View more
6 hours ago
|
0
|
9
|
113
|
IDEA
|
This is already available in the Field Maps Designer. See this documentation The Field Maps mobile app provides access to maps that are shared with or owned by a mobile worker. You may have maps that you don't want accessed from the mobile app. For example, you may have maps that are made for ArcGIS Dashboards that are for desktop use only. To hide maps you own from the Field Maps mobile app, complete the following steps...
... View more
10 hours ago
|
0
|
0
|
69
|
POST
|
Honestly, I'm stumped on this. I don't have access to a dataset on Oracle, so I can't do further testing to see how the syntax may be different..
... View more
yesterday
|
0
|
0
|
18
|
POST
|
It won't filter correctly since the variable value has to be five characters long. Try this instead var value = Left($feature.WINDEX, 5);
var cur_unitid = Filter(FeatureSetByName($datastore, "WSL", ['UNITID'], false), "Substring(UNITID, 1, 5) = @value");
... View more
yesterday
|
0
|
4
|
25
|
POST
|
The testing I've done in the Playground using the example public portal item has worked correctly. Are you sure you have the correct information for the FeatureSetByName function? What happens with this code? var cur_unitid = FeatureSetByName($datastore, "WSL", ['UNITID'], false);
return Count(cur_unitid);
... View more
yesterday
|
0
|
1
|
42
|
POST
|
Let's check whether you're getting anything back from the Filter var value = $feature.WINDEX;
var cur_unitid = Filter(FeatureSetByName($datastore, "WSL", ['UNITID'], false), "Substring(UNITID, 1, 5) = @value");
return Count(cur_unitid);
... View more
yesterday
|
0
|
3
|
95
|
POST
|
What happens with this code? I know it's not giving the maximum record, but it's just testing out the filtered result. var value = $feature.WINDEX;
var cur_unitid = Filter(FeatureSetByName($datastore, "WSL", ['UNITID'], false), "Substring(UNITID, 1, 5) = @value");
//var cur_unitid_desc = OrderBy(cur_unitid, 'UNITID DESC');
var cur_unitid_max = First(cur_unitid);
return cur_unitid_max.UNITID;
... View more
yesterday
|
0
|
5
|
98
|
POST
|
Have you tried completing the rule, adding in what you want to return?
... View more
yesterday
|
0
|
7
|
102
|
POST
|
If you like the idea, please Kudo it so it gets more visibility and a higher priority for fixing.
... View more
yesterday
|
0
|
0
|
14
|
POST
|
Your sql expression is invalid, since it doesn't understand Arcade syntax (including variables such as $feature). You can only use SQL92 syntax. An expression like this should work var value = $feature.WINDEX;
var cur_unitid = Filter(FeatureSetByName($datastore, "WSL", ['UNITID'], false), "Substring(UNITID, 1, 5) = @value");
var cur_unitid_desc = OrderBy(cur_unitid, 'UNITID DESC');
var cur_unitid_max = first(cur_unitid_desc);
... View more
yesterday
|
0
|
9
|
116
|
POST
|
Nice solution. I always forget about utilizing the power of SQL in the GroupBy
... View more
Monday
|
0
|
0
|
119
|
Title | Kudos | Posted |
---|---|---|
2 | Monday | |
3 | Monday | |
1 | Monday | |
1 | Monday | |
1 | 2 weeks ago |
Online Status |
Online
|
Date Last Visited |
5 hours ago
|