Frequently asked question
It is possible to perform calculations using values from another feature in the Calculate Field tool in ArcGIS Pro. When running calculations on a field in an attribute table or a standalone table, the ArcGIS Arcade FeatureSetByName() and the FeatureSetByPortalItems() functions allow the retrieval of the values from fields in different tables. Use the FeatureSetByName() function for value retrieval between tables within ArcGIS Pro, and the FeatureSetByPortalItems() function for value retrieval with a connected portal, using either the ArcGIS Online organizational account or the ArcGIS Enterprise portal.
When using the FeatureSetByName() function, the following parameters must be considered:
The function is displayed as follows:
FeatureSetByName(<data_location>,'<feature_name>', ['<field_name1>', '<field_name2>', ....] <geometry>);
The following is a sample working code to add the first value from another table into the current table in the Calculate Field tool:
var tbl = FeatureSetByName($datastore,"house",['Shape_Length'], False); var feat = First(tbl) return $feature.Shape_Length + feat.Shape_Length
When using the FeatureSetByPortalItem() function, the following parameters must be considered:
The function is displayed as follows:
featureSetByPortalID(Portal(<Portal URL>, "<feature_ID>", "<sublayer_ID>”, ['<field_name1>', '<field_name2>', ...] <geometry>)
The following is a sample working code to count the number of features from another table in ArcGIS Online or Enterprise portal into the current table in the Calculate Field tool:
var feat = FeatureSetByPortalItem(Portal('https://www.arcgis.com'), 'c43e270e9casdfasxcaedc6', 0, ['Direction'], false ); Count(feat);
var feat = FeatureSetByPortalItem(Portal(‘https://machine.domain.com/portal'), 'c43awsfvsdrvsaf7a009c27ad38fce96', 1, ['Direction', 'Signs'], false ); Count(feat);
Article ID: 000031106
Get help from ArcGIS experts
Download the Esri Support App