This is my first time working with Arcade and Attribute Rules is ArcGIS Pro 2.9. I'm working on rules to assist with the development of Address Points. One task, when creating or updating an address point I need to pull the parcel number value from our Tax Parcel data using an intersect. When trying to specify the TaxParcelPoly to pull the parcel number I get an error message. I don't have a good understanding of how database should be called using Arcade.
This is the statement that I have so far:
var fsTaxParcel = FeatureSetByName($datastore,"GISdw.DCL.TaxParcelPoly",["PARCELNO"])
var fsParcelIntersect = Intersects(fsTaxParcel, $feature)
var ParcelNum = First(fsParcelIntersect)
Error Message: Invalid expression. Error on line 1. Table not found GISdw.DCL.TaxParcelPoly
You load a feature class from the database with
FeatureSetByName($datastore, "Database.DataOwner.TableName")
It's telling you that it can't find the table "GISdw.DCL.TaxParcelPoly" in the datastore. You should check:
Thanks Johannes,
The address points are in a different database, in a separate production database that is database = (AddressPointsa), data owner name = (DCL), feature class name = (AddressPointCSP). My objective is to the tax parcel number of a feature that is our publishing database, database = (GISdw), data owner name = (DCL), feature class name = (TaxParcelPoly). Are you saying that Attribute Rules require that any feature class that I need to pull data from has to be in the same database as my production data? That will be an issue and make the use of Attribute Rules a lot more complicated.
Fred
Just as a follow up, the data I'm trying access attributes are not in a same database. Rather I'm looking to access data that I'm adding to the Pro project. With that, then I should be using $map instead of $datastore. When I do that I also get an error "Object not found $map". Still not able to make it work.
Because Arcade is used for many different things (eg Attribute Rules, popups, labeling, symbology, field calculation), there are differences in what global variables (like $feature, $map, and $datastore) get exposed to the user. The exposed globals are described in the Arcade profiles. For example, here is the profile for Calculation Attribute Rules: Profiles | ArcGIS Arcade | ArcGIS Developer
Attribute Rules should work regardless from where you trigger them, so it's sensible that you don't get access to $map.
For accessing data from different databases the only option I know of is publishing that data to AGOL or Portal and then using FeatureSetByPortalItem().