POST
|
I finally figured this out. Something so easy I can't believe I overlooked it. I was applying the attribute rule to that parent feature class in the relationship class. This is incorrect. The attribute rule should be applied to the child feature class. The one where the edits are applied to once the parent feature class is triggered with an update. I was also able to simplify the code. I was making to complex trying to get it to work. Below is the code that ended up doing the trick. I did notice a delay in the updates to the child feature class. // calculation attribute rule on child
// field: if you want to get only one field from the parent, then chose
// that field. if you want to get multiple fields, leave empty
// triggers: Insert(, update)
// load the related parent features using
// a relationship class between parent and child:
var parent_fs = FeatureSetByRelationshipName($feature, "db.schema.AttributeRuleName")
// return nothing if no parent feature was found
var parent = First(parent_fs)
if(parent == null) { return }
// if you want to return multiple fields:
var att = {
"accountableorganization": parent.accountableorganization,
"coordinatex": parent.coordinatex,
"coordinatey": parent.coordinatey
}
return {"result": {"attributes": att}}
... View more
11-15-2024
09:37 AM
|
1
|
1
|
1285
|
POST
|
it would be good news if I ran it and got that message but that is in the expression builder. I can't even save it at this point. ESRI makes it hard to debug in this interface.
... View more
10-25-2024
11:28 AM
|
0
|
0
|
1397
|
POST
|
yeah I updated my code but still get an error. Invalid Expression No features found // Step 1: Get the related records from site_a using the correct relationship class name
var relatedRecords = FeatureSetByRelationshipName($feature, "usar_hq.rd_81.Site_P_Site_A", ["*"], false);
// Step 2: Get the first related record
// Explanation: We use the First() function to get the first record from the related records.
var related_record = First(relatedRecords);
// Step 3: Check if a related record is found
// Explanation: We check if related_record is null. If it is, we return null to stop further processing.
if (related_record == null) {
return null;
}
// Debugging: Print the related record
Console("Related record: " + Text(related_record));
// Step 4: Populate fields in the main feature class with fields from the related record
// Explanation: We create an object to return the desired fields from the related record.
return {
//result is a dictionary
"result": {
"attributes": {
"debug_field": related_record.debug_field
//"accountableorganization": related_record.accountableorganization,
}
}
}
... View more
10-25-2024
09:50 AM
|
0
|
2
|
1401
|
POST
|
When I update site_p I want the correlating fields in site_a to be updated as well. The relationship class is realated on the field "rpsuid" Here is my code: // Step 1: Get the related records from site_a using the correct relationship class name
var relatedRecords = FeatureSetByRelationshipName($feature, "usar_hq.rd_81.Site_P_Site_A", [], false);
// Step 2: Get the first related record
// Explanation: We use the First() function to get the first record from the related records.
var related_record = First(relatedRecords);
// Step 3: Check if a related record is found
// Explanation: We check if related_record is null. If it is, we return null to stop further processing.
if (related_record == null) {
return null;
}
// Debugging: Print the related record
Console("Related record: " + Text(related_record));
// Step 4: Populate fields in the main feature class with fields from the related record
// Explanation: We create an object to return the desired fields from the related record.
return {
"debug_field": related_record.debug_field
// Add more fields as needed
// Uncomment and modify the lines below to include additional fields
// "accountableorganization": related_record.accountableorganization,
// "anotherfield": related_record.anotherfield
}; and I get this error: Edit operation failed. Message: Unable to complete operation. Details: Internal error during object update. Undefined keyword is used in the dictionary return script. [ Rule name: Site_p2a, Triggering event: Update, Class name: Site_P, GlobalID: {AAF25529-13CD-448C-BDC2-C83DE21711EF}], Undefined keyword is used in the dictionary return script. [debug_field] debug_field does exist in the feature class and service. What am I doing wrong? I am sure it is a stupid syntax error on my part.
... View more
10-24-2024
08:03 AM
|
0
|
9
|
1486
|
IDEA
|
When trying to write attribute rules in Pro there is no debugger. Please put in some sort of developing method to debug arc
... View more
10-18-2024
09:38 AM
|
0
|
0
|
782
|
IDEA
|
When trying to write attribute rules in Pro there is no debugger. Please put in some sort of developing method to debug arc
... View more
10-18-2024
09:37 AM
|
0
|
1
|
455
|
IDEA
|
When trying to write attribute rules in Pro there is no debugger. Please put in some sort of developing method to debug arc
... View more
10-18-2024
09:36 AM
|
0
|
1
|
453
|
IDEA
|
When trying to write attribute rules in Pro there is no debugger. Please put in some sort of developing method to debug arcade in Pro.
... View more
10-18-2024
09:29 AM
|
0
|
1
|
430
|
IDEA
|
When trying to write attribute rules in Pro there is no debugger. Please put in some sort of developing method to debug arcade in Pro.
... View more
10-18-2024
09:27 AM
|
0
|
1
|
408
|
DOC
|
Do you have a tool available to iterate through your feature classes to create materialized view in postgres. Creating them all manually is tedious at best. Traditional versioning had an evw created for each FC already. Is that something that will be available down the line?
... View more
04-19-2024
07:37 AM
|
0
|
0
|
5997
|
POST
|
So how can I add this to my attribute rules to auto populate my MGRS field? We are on 11.2 and Pro 3.2
... View more
03-19-2024
12:03 PM
|
0
|
0
|
1325
|
POST
|
The above syntax works with Feature Classes from a gdb but we are trying to make this work with Feature Services as layers in a pro project map.
... View more
08-28-2023
08:16 AM
|
0
|
0
|
682
|
POST
|
for m in aprx.listMaps():
for lyr in m.listLayers():
if lyr.isFeatureLayer:
arcpy.management.SelectLayerByAttribute(lyr,"NEW_SELECTION", "facilityid = 'AR022'")
else:
print(" " + lyr.name + "no features") The above code works if all the layers in the map have "facilityid" as a field. How can I put a precheck on that constraint so this just doesn't error out. I thought this would work but it gives me a 999999 runtime error. for m in aprx.listMaps():
for lyr in m.listLayers():
if arcpy.ListFields(lyr, 'facilityid'):
print (lyr.name)
else:
print ("Field does not exist " + lyr.name) any suggestions would be appreciated.
... View more
08-25-2023
12:48 PM
|
1
|
1
|
777
|
Title | Kudos | Posted |
---|---|---|
1 | 10-08-2020 07:43 AM | |
1 | 10-08-2020 07:22 AM | |
1 | 11-15-2024 09:37 AM | |
1 | 08-25-2023 12:48 PM | |
1 | 04-08-2022 12:13 PM |
Online Status |
Offline
|
Date Last Visited |
3 weeks ago
|