|
POST
|
Below an example of the featureset that will be returned using some random values for the counts:
... View more
05-03-2021
01:56 PM
|
0
|
12
|
10832
|
|
POST
|
Hi @erica_poisson and @KenBuja , You actually can return an in-memory featureset with the data that you want to graph. Since I am not sure what you are exactly after I will provide an example and you can adjust accordingly. See the example below (please note that the filter expression is using the syntax suggested by Ken). The first part is pretty much the same, but after getting the counts, you create a schema for the output featureset, and fill it with the data. In this case, it will be a featureset with 3 fields and only 1 row. This can be used in the Dashboard as data source. var p = 'https://www.arcgis.com';
var itemID_CMpts = 'xxx';
var layerID_CMpts = 0;
var itemID_join = 'xxx';
var layerID_join = 0;
var fs1 = FeatureSetByPortalItem(Portal(p), itemID_CMpts, layerID_CMpts, ['Point_Status', 'EQ_File_Number'], false);
var filterCMpts = Filter(fs1, "Point_Status ='Unstable' AND EQ_File_Number In ('EQ2015-078', 'Eq2013-026', 'EQ2018-082', etc)" );
var fs2 = FeatureSetByPortalItem(Portal(p), itemID_join, layerID_join, ['Point_Status_revisit', 'EQ_File_Number'], false);
var filterJoin = Filter(fs2, "Point_Status ='Unstable' AND EQ_File_Number In ('EQ2015-078', 'Eq2013-026', 'EQ2018-082', etc)");
var CntCMpts = Count(filterCMpts);
var CntJoin = Count(filterJoin);
// create data schema
var Dict = {
'fields': [
{'name': 'CntCMpts', 'type': 'esriFieldTypeInteger'},
{'name': 'CntJoin', 'type': 'esriFieldTypeInteger'},
{'name': 'CntCMptsMinusCntJoin', 'type': 'esriFieldTypeInteger'}],
'geometryType': '',
'features': []};
// fill the data schema with the data
Dict.features[0] = {
'attributes': {
'CntCMpts': CntCMpts,
'CntJoin': CntJoin,
'CntCMptsMinusCntJoin': CntCMpts - CntJoin
}}
// return the featureset
return FeatureSet(Text(Dict));
... View more
05-03-2021
01:50 PM
|
3
|
14
|
10834
|
|
POST
|
Hi @MeleKoneya , As @jcarlson mentions an Arcade expression in a web map is not be able to return HTML with multiples hyperlinks (in ArcGIS Pro you can do this). If the pop-up needs to show multiple attachments, the (New) Map viewer is able to do this. If you have multiple picture attachments they will show up in the pop-up: You can enter the settings and switch off the list option to preview the pictures a bit bigger:
... View more
05-03-2021
11:47 AM
|
0
|
0
|
1462
|
|
POST
|
Hi @kshahmmp , A couple of pointers here. When you want to access to value in a field called "FieldName1", you can use two ways to do this: $feature.FieldName1
$feature["FieldName1"] The second option is preferred when you have a field name containing an underscore: $feature["Field_Name1"] The code you posted raised a couple of questions: Do you want to return a text containing the values of 3 fields separated by a comma? Do you want to return the same 3 fields when FieldName4 is either 1 and 2 (or are there other fields to return?) Based on a number of assumptions see the example below. In this case, when FieldName4 is 1 a text with FieldNames 1, 2, and 3 will be returned and when FieldName4 is 2, a text with FieldNames 5, 6, and 7 will be returned. It uses the Concatenate function and provides an array (list) of the field values and the text to separate the field values. if ($feature.FieldName4 == 1) {
return Concatenate([$feature.FieldName1, $feature.FieldName2, $feature.FieldName3], ", ");
} else if ($feature.FieldName4 == 2) {
return Concatenate([$feature.FieldName5, $feature.FieldName6, $feature.FieldName7], ", ");
}
... View more
05-03-2021
11:27 AM
|
1
|
3
|
13775
|
|
POST
|
Hi @ChrisDeuchars , If you look at the Arcade help for Area: https://developers.arcgis.com/arcade/function-reference/geometry_functions/#area and AreaGeodetic https://developers.arcgis.com/arcade/function-reference/geometry_functions/#areageodetic you will notice that the AreaGeodetic function is more precise than the Area function. Returns the geodetic area of the input geometry or FeatureSet in the given units. This is more reliable measurement of area than Area() because it takes into account the Earth's curvature. I will be better to use the AreaGeodetic function. However, there is another important note in the help: Be aware that using $feature as input to this function will yield results only as precise as the view's scale resolution. Therefore values returned from expressions using this function may change after zooming between scales. Since in your example you mention that you have access to the "Shape_Area", this would be the prefered source of truth. Use Area and AreGeodetic in case you intersect o merge (union) features or when you don't have access to the system maintained area (Shape_Area).
... View more
04-22-2021
01:22 PM
|
0
|
0
|
1733
|
|
POST
|
Hi @MCouden , Values 1 and 3 do not sound like domain descriptions to me. I suppose they are the actual code values stored in the field. If that is the case you can do something like this: if (Includes([1, 3], $feature["REVIEW_STATUS"])) {
return "Other";
} I used the more or less new Includes function to shorten the validation and I am testing to the value stored in the field (the code in the domain). You may also want to include an else statement since otherwise, you will only see "Other" and nothing. Maybe something like this: if (Includes([1, 3], $feature["REVIEW_STATUS"])) {
return "Other";
} else {
return DomainName($feature, "REVIEW_STATUS");
} In the example, I return the text "Other" and not the description that corresponds to a code "other" from the domain you mentioned and Ken showed in his solution. If you need the description rather than the text "Other" you should use Ken's solution.
... View more
04-20-2021
07:00 AM
|
1
|
0
|
1122
|
|
DOC
|
Hi @JussiLehtonen , The Field Calculation profile only supports $feature and $datastore. So this means that the data you want to use in the calculation must be in the same $datastore (FGDB, EGDB, hosted feature layer, etc). Although the FeatureSetByPortalItem is available, I haven't been able to use it successfully in ArcGIS Pro for a field calculation. With the latest version of ArcGIS Dashboards, you can create featuresets on the fly with Arcade and use them as data source. This uses FeatureSetByPortalItem to access the data, so I assume that it a matter of time it will be able to use data from different data sources in an Arcade expression to calculate a field.
... View more
04-20-2021
06:36 AM
|
0
|
0
|
13235
|
|
POST
|
Hi @Anonymous User and @DanPatterson , Unfortunately, Arcade does not yet provide the possibility to project a geometry to a different coordinate system. There are some examples that allow calculating the corresponding latitude and longitude coordinates when you have the standard Web Mercator Auxiliary Sphere as input coordinate system. The case mentioned above uses a mathematical formula to calculate the corresponding WGS 1984 coordinates. In case you have the formula you can implement it in Arcade. However, this might be complex and sometimes not very precise.
... View more
03-25-2021
09:12 AM
|
1
|
1
|
5645
|
|
DOC
|
Hi @RickardNasstrom , It is strange that it would not work in Map Viewer Beta, since it should. I just did a test with the example that I constructed for this post and it works as expected in the Map Viewer Beta: The first thing where I would look at is renaming the layer and not using special characters provides a valid result. I don't see anything else that could explain this behaviour.
... View more
03-25-2021
09:04 AM
|
0
|
0
|
13644
|
|
POST
|
Hi @AllisonMuise2 , Sorry for the delay. I am sure we will have this functionality in the future, but unfortunately, I don't have an ETA.
... View more
03-25-2021
08:32 AM
|
0
|
2
|
5009
|
|
POST
|
Hi @GISUSER6 , I did a test with a local coordinate system and it will work with some minor adjustments: You will need to: Use Buffer instead of BufferGeodetic Use Distance instead of DistanceGeodetic Place "var" before street in the for loop. var streetLayer = FeatureSetByName($datastore, "streets_WGS_Project", ["NAME"]);
var searchDistance = 100;
var streetIntersect = Intersects(streetLayer, Buffer($feature, searchDistance, "feet"));
var cnt = Count(streetIntersect);
var minDistance = Infinity;
var name = Null
if (cnt > 0) {
for (var street in streetIntersect) {
var dist = Distance(street, $feature, "feet");
if (dist < minDistance) {
name = street.NAME;
minDistance = dist
}
}
} else {
// pass no features found within search distance, name remains null
}
return name;
... View more
03-12-2021
05:45 AM
|
4
|
1
|
5203
|
|
POST
|
Hi @JoeBorgione , Thanks for getting back. It makes sense what you are saying. I think it should be possible to return multiple values in a single Attribute Rule, but I haven't seen examples of this. I do suppose that it follows the same logic as the "Edit another feature class with a calculation rule" example here: https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-script-expression.htm#anchor4 (but I am not sure)
... View more
03-04-2021
02:39 PM
|
1
|
0
|
9315
|
|
BLOG
|
Hi @utenalarosa , Don't worry the important thing is that we figured it out and it is working now!
... View more
03-04-2021
01:33 PM
|
0
|
0
|
5006
|
|
BLOG
|
Hi @utenalarosa , I see what is wrong. The expressions are correct but you have to correct the HTML. In the HTML you are using "{espression/expr6}" when it has to be "{expression/expr6}". It is the same for all the other expressions that you are calling in the HTML of the pop-up.
... View more
03-04-2021
01:26 PM
|
0
|
0
|
5017
|
|
BLOG
|
Hi @utenalarosa , Thanks for sharing the URL of the service. As I expected the "empty" fields contain a single space and therefore are not considered empty. To avoid this change your expressions to use Trim: IIf(IsEmpty(Trim($feature["Owner_Name"])), "", "Owner Name");
... View more
03-04-2021
12:50 PM
|
0
|
0
|
5023
|
| Title | Kudos | Posted |
|---|---|---|
| 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 | |
| 1 | 05-29-2019 02:45 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-26-2025
02:43 PM
|