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 Portal for ArcGIS.
When using the FeatureSetByName() function, the following parameters must be considered:
The following is what the function looks like:
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 the Calculate Field tool is run on:
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 Portal for ArcGIS into the current table the Calculate Field tool is run on:
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);
Get help from ArcGIS experts
Download the Esri Support App