Attribute rule to copy attributes from another table

533
5
01-29-2024 10:41 AM
AdamHart1
New Contributor III

I am wondering if anyone has any experience with this workflow. I have a table from our CAMA software and I would like to copy some attributes from that table into the Records table using an attribute rule. Basically, if the parcel number in the CAMA table matches the parcel number in the Records table, then populate the specific field in the Records table with the legal description. The CAMA table is in the same FDGB as the Records. I have the Arcade code attached. It runs without errors but when I make an edit in the records, the field with the rule just returns Null. I would like to set up other rules similar to this so that CAMA data comes over much quicker. 

Thanks

0 Kudos
5 Replies
AmirBar-Maor
Esri Regular Contributor

@AdamHart1 

Great to see integration to the CAMA data.

All the variables in your expression are 'Feature Sets' - those are collections of features. You also have variables that are not used.

I can help you with the expression if you can share a small portion of the data. If the data is sensitive you can  export an empty schema as XML Workspace and then import it to a new file geodatabase, add a couple of rows manually with the data you want to see copied over.

0 Kudos
AdamHart1
New Contributor III

@AmirBar-Maor 

Thanks for being willing to help with this. I have attached a small sample of the data I am using. The CSV is the standalone table from our CAMA data. The other attachment is a shapefile of the record related to the table. I do have a support case open currently related to this, but I thought it would be useful to post it here too. The support technician found this other code that seems to work but only because I manually created the Parent1 field in the standalone table and copied the parcel numbers to that field. So I am hoping to compare the ParcelNumber field to the Parent/child fields in the records table to get the correct data to come over. Any help would be greatly appreciated.

DrewDowling
Occasional Contributor III

Hi Adam

I have some code that does something similar that you should be able to adapt. On any feature Insert or update, it queries a table, t.Road_atr, for a related record and updates that record with a value from the feature being updated.

 

//get the road_atr record

var results = FeatureSetByName($datastore, 'T.Road_atr', ['GlobalID', 'FNODE', 'TNODE', 'ObjectID'], false)
var roadsegid = $feature.roadsegid
var atrset = Filter(results, 'roadsegid = @roadsegid');



if(Count(atrset) > 0){
    var atr = First(atrset);
    console(atr.objectID);
    // atr.GlobalID,

    return {
        'edit': [{
            'className': 'T.Road_atr',
            'updates': [{
                'objectID': atr.objectID,
                'attributes':{
                    'FNODE': $feature.from_interid,
                    'TNODE': $feature.to_interid
                
                    }
            }]
        }]
    }
    
}

 

 

AmirBar-Maor
Esri Regular Contributor

@AdamHart1 

Thanks for providing the data.

In order to copy data from the CAMA table to the Records table we'll need a unique value in both tables.

In the CAMA table you want to use a field called 'ParcelNumber' which contains an APN (PIN)

The record name is "Lincoln_Merge_2024_22652" (Name field) - I would expect the record name to be used to link the 2 tables.

The fields 'Created Parcel Count' and 'Retired Parcel Count' in the records table store the number of parcels that the record created and retired, and not a unique value.

Once we find a the field that has a unique value in both tables, the Attribute Rule can copy any field from CAMA to the records table.

Can you please clarify?

 

 

 

 

0 Kudos
AdamHart1
New Contributor III

@AmirBar-Maor 

Sorry for the delay. It's one of our busiest times of the year in the property assessment field. 

Yeah I know there isn't a unique field to link the two tables. The record name is generated using an attribute rule, so to also have that in the CAMA table would have to be figured out on my end. I did have a support case open that did help as a workaround, but I would like to be more efficient than the workaround. Below is the code that I used to copy over attributes. This only worked because I have a bunch of identical fields with almost identical field names in the CAMA table.

 

var sourceTable = FeatureSetByName($datastore,"BSAParcelTableforSplitReport", ["Child1", "LegalDesc"], false)

for (var i in sourcetable)
if (i.Child1 == $feature.Child1)
{
return i.LegalDesc
}