Hi All,
I'm trying to add a field to the Change Log table I've created that tracks edits to our data. The new field would record the changes made to the field values of a feature and would be in dictionary format (field output would be "x field: y new field value, z field: w new field value...). I only want to record fields that have had edits made to them. Here's the code I have so far-- I'm trying to create an empty dictionary, use the Schema tool to get the field names and values, compare them, and push values to the new dictionary that are different from the original values.
var DeviceFeatureEdits = FeatureSetByName($datastore, 'ElectricDevice',['*'], true)
var editscalc = Dictionary()
//schema function returns an array of dictionaries, includes field names
var Cschema = Schema(DeviceFeatureEdits)) //Cschema is the post edit dictionary of field values
var Oschema = Schema(DeviceFeatureEdits.$originalfeature)) //Oschema is the pre-edit dictionary of field values
if (Oschema.assetid != Cschema.assetid){
push (editscalc, Cschema.assetid)
}
//I repeat the above If statement for all the fields.
The lines where I use the Schema function keep causing either "semicolon or new line expected" or "reserved keyword used". Is the schema function not applicable to attribute rules, or am I using it wrong? Is this a viable way to do what I'm trying to do?
Thank you!