|
POST
|
Hi Brian.Acheff ; The error you are receiving may be caused by not having a result in the intersection. Can you try this? // don't do any intersects if you are not going to use it
if (IsEmpty($feature.MACOD_ID)) {
// intersect the data (don't retrieve the geometry when you don't need it)
var fs = Intersects(FeatureSetByName($datastore, "MACOG_Intersections_Poly", ["MACOG_ID"], False), $feature);
// count the resulting features
var cnt = Count(fs);
// don't try and access the first feature if there are no features
if (cnt > 0) {
// get the first feature and return the MACOG_ID
var feat = First(fs);
return feat["MACOG_ID"];
}
}
... View more
09-18-2020
08:23 AM
|
1
|
2
|
1823
|
|
POST
|
Hi ANDREW BUTTERFIELD , I am glad to hear that this is what you were trying to establish. Could you mark the post that answered the questions as the correct answer? At this moment the thread is marked as "assumed answered". Thanks!
... View more
09-17-2020
01:02 PM
|
0
|
11
|
3767
|
|
POST
|
Hi ANDREW BUTTERFIELD , It seems that there is something strange going on in your data. I was expecting to find a relationship from the organizations info to the venue locations, but I only found one relationship towards Form_2. And when I try to use it, it returned an empty string as the relationship name: Earlier you mentioned that the link between the two layers is established using the organization name, so I used that instead. have a look at the expression below: // use organization name and venue name to link the information
var orgname = $feature["org_name"];
// access the venue featureset
var fsvenues = FeatureSetByName($map,"Venue Locations", ["org_venue", "org_venue_address", "org_venue_type"], False);
// create a SQL query to get the related venues
var sql = "org_name = @orgname";
// filter venues on org name / venue location
var venues = Filter(fsvenues, sql);
// count venues
var cnt = Count(venues);
// loop through venues and create result
var result = "";
if (cnt > 0) {
// there are venues found, loop through venues
result = cnt + " venues found:"
for (var venue in venues) {
// add venue information to the result
result += TextFormatting.NewLine + TextFormatting.NewLine + venue["org_venue"];
result += TextFormatting.NewLine + venue["org_venue_type"];
result += TextFormatting.NewLine + venue["org_venue_address"];
}
} else {
// no venues found
result = "no venues found...";
}
return result;
The result will show like this: Is this what you are after?
... View more
09-17-2020
12:23 PM
|
3
|
13
|
5220
|
|
POST
|
Hi Brian.Acheff , Maybe it is best to show what I mean it the expression: if ($feature["MACOG_ID"] == null) {
// first returns a feature
var feat = First(Intersects(FeatureSetByName($datastore, "MACOG_Intersections_Poly", ["MACOG_ID"]), $feature));
// access the attribute to return the actual value
return feat["MACOG_ID"];
}
... View more
09-17-2020
10:50 AM
|
2
|
5
|
4573
|
|
POST
|
Hi Brian Acheff , In this screenshot on line 13 you are using as update the text 'MACOG_ID'. This should be updates array you created before. See algo the example expression called "Edit another feature class with a calculation rule." in this link: Attribute rule script expression examples—ArcGIS Pro | Documentation
... View more
09-17-2020
10:38 AM
|
2
|
0
|
4573
|
|
POST
|
Hi Brian Acheff , Let me respond to this comment first. When you return the First record of an intersect, you are returning an entire record. Not only the MACOG_ID value even though it is the only attribute you are requesting. You would have to query the actual field to get the value (adding for instance ["MACOG_ID"] at the end of the line).
... View more
09-17-2020
10:33 AM
|
2
|
7
|
4573
|
|
POST
|
Hi ANDREW BUTTERFIELD , The second thing I would validate is the name of the relationship used on line 3. Since you had additional spaces in the name, I assume that you configured it manually and not using the interface. It is best to use the interface to avoid any typos in the process. So, go into the Arcade expression editor, click the ">" right to $feature: Next, at the end of the list of attributes of the $feature you will find something called "Related records". Click the ">" right to it: This will reveal the relationships that the layer has. Click on the "FeatureSetByRelationshipName" to insert the code into the expression. Edit the fields (watch out with additional spaces). If it continues to produce errors, I would need to have access to the data to investigate a bit more. You could share the map and data to a new group and invite me "xbakker.spx" to this group to have access to the data and test the expression more efficiently.
... View more
09-17-2020
10:20 AM
|
0
|
15
|
5220
|
|
POST
|
Hi ButterfieldLECP , I assume that this is caused by the additional space around the relationship name and the field names. Have a look at lines 3 and 16 where this is the case in the expression you shared. Can you try this? // user clicked on organization, so that will be your $feature
// get related venue records, change name of relationship and fields according to your data
var fsvenues = FeatureSetByRelationshipName($feature, "repeat_venue", ["org_venue", "org_venue_address"], False);
// initialize result text and get count
var result = "";
var cnt = Count(fsvenues);
// check count and start creating result text
if (cnt > 0) {
// we have related records
result = cnt + " repeat_venue:";
// loop through venues
for (var venue in fsvenues) {
// add a line per venue and include name and address
result += TextFormatting.NewLine + " - " + venue["org_venue"] + " (" + venue["org_venue_address"] + ")";
}
} else {
// we don't have related record, show that in the result
result = "No venues found";
}
return result;
... View more
09-17-2020
09:22 AM
|
0
|
17
|
5220
|
|
POST
|
Hi Brian Acheff , The error message is indicating that you cannot use the $map global variable in a field calculation of an attribute calculation rule. You should use the $datastore instead. See Profiles | ArcGIS for Developers for more information on what global variables and functions are available in each profile.
... View more
09-17-2020
07:03 AM
|
2
|
3
|
4573
|
|
POST
|
Hi ButterfieldLECP , Let me know if you run into any problems. Happy to help.
... View more
09-17-2020
06:55 AM
|
0
|
19
|
5220
|
|
POST
|
Hi sbreckan , After you define the expression, you will only see the symbols corresponding to the current scale. In case you have a single symbol, this is not a problem, since you can use the "Other" option to define the alternative symbol. As shown below when the scale is 50K or more, the symbol is a simple square: When we zoom in one step (view scale below 50K), the symbols change to be a larger house. You can define any symbol including an image using an URL:
... View more
09-17-2020
06:52 AM
|
0
|
0
|
2638
|
|
POST
|
Hi Pauline Low Pui Ling , Unfortunately, I haven't seen this functionality in the webmap of ArcGIS Enterprise and ArcGIS Online. In ArcGIS Pro you can export the expression when defining for instance an expression in the pop-up creating a label expression file which contains the Arcade expression or a calculate field expression file when calculating a field. This functionality is not available in the web map. As I mentioned before, I copy some of the expressions in a text editor and save the files. Perhaps not ideal, but it doesn't take much time to do this.
... View more
09-17-2020
06:35 AM
|
0
|
1
|
2703
|
|
POST
|
Hi ANDREW BUTTERFIELD , See below a simple example based on what you described: // user clicked on organization, so that will be your $feature
// get related venue records, change name of relationship and fields according to your data
var fsvenues = FeatureSetByRelationshipName($feature, "Name of the relationship to access venue", ["name", "address"], False);
// initialize result text and get count
var result = "";
var cnt = Count(fsvenues);
// check count and start creating result text
if (cnt > 0) {
// we have related records
result = cnt + " venues found:";
// loop through venues
for (var venue in fsvenues) {
// add a line per venue and include name and address
result += TextFormatting.NewLine + " - " + venue["name"] + " (" + venue["address"] + ")";
}
} else {
// we don't have related record, show that in the result
result = "No venues found";
}
return result;
... View more
09-16-2020
02:59 PM
|
0
|
21
|
5220
|
|
POST
|
Hi Paul Sweeney , Do you know if collector or the new field maps app will support featuresets anytime soon? Unfortunately, I do not know if this will be supported anytime soon. I do have ArcGIS Field Maps installed, but I haven't had the opportunity to play with it a lot. The best way of getting an answer to this question, would be to engage in the early adopter community and talk directly to the product managers and developers and being able to influence those features that will be included in the final version: ArcGIS Field Maps (Early Adopter Site) A couple of additional points I had hope to use collector and pass values to survey123 however I realised featureset s were not supported. I am now calculating the fields first to pass them through.i am setting up a model in pro to do this but I was wondering if arcade expressions ,specifically using featuresetbyportalitem , are achievable using the python Api and would it be a faster method then model builder to run. Using a model, a python script, a home baked GP tool or a Jupyter notebook and the Python API are all ways you can use to do this. Make sure the identity that you are using has access to the data and use the option that works best for you.
... View more
09-16-2020
12:20 PM
|
0
|
2
|
3376
|
|
POST
|
Hi S B , You can use an expression like the one below to define a symbol based on the view scale of the map: var scale = $view.scale;
if (scale > 50000) {
return "Description for > 50000 symbol";
} else {
return "Description for <= 50000 symbol";
}
... View more
09-16-2020
11:08 AM
|
0
|
2
|
2638
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-09-2020 09:26 AM | |
| 6 | 12-20-2019 08:41 AM | |
| 1 | 01-21-2020 07:21 AM | |
| 2 | 01-30-2020 12:46 PM | |
| 1 | 05-30-2019 08:24 AM |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|