POST
|
I was able to resolve this but I still think it should have worked with the first code I posted. By checking the database after every entry, I figured out that any fields not being edited were getting the wrong value. By switching from $feature.attribute to $originalFeature.attribute I was able to get the desired results. if ($originalFeature.JobStatus == $feature.JobStatus){
return $originalFeature.JobStatusLastEdit
} else {
return Now()
}
... View more
10-31-2020
04:04 PM
|
0
|
0
|
911
|
POST
|
I have five attribute rules on a feature service layer. Each one is supposed to update a "<field>LastEdit" attribute. Where I have five fields [JobStatus, WorkOrder, EstCompletionDate, DueDate, Dispatch] and their respective trackers [JobStatusLastEdit, WorkOrderLastEdit, EstCompletionDateLastEdit, DueDateLastEdit, DispatchLastEdit]. Each rule looks like: if ($originalFeature.JobStatus == $feature.JobStatus){
return $feature.JobStatusLastEdit
} else {
return Now()
} When in Pro, I can edit all five fields and save my changes and each respective LastEdit field will be updated. When in a Portal map, I edit all five fields and only the last field to be edited gets it's LastEdit field updated (I've tried every combination). Using Fiddler, I noticed that EACH Portal update sends a REST post for applyEdits individually while Pro sends a REST post for updates all at once. I can't figure out why the applyEdits Post from Portal map isn't triggering all the rules. Is there something I need to do with versioning or another configuration I missed before deploying the FS?
... View more
10-28-2020
11:30 AM
|
0
|
2
|
979
|
POST
|
I added zipCodes to the FS and no dice. All other attribute rules run as expected with the expected outcomes. The only rule not working over REST is the rule updating Shape. I went ahead and wrote a database trigger straight to SQL Server as a work around.
... View more
10-28-2020
11:19 AM
|
0
|
0
|
404
|
POST
|
One more note... This does work when adding a feature on a map connected directly to the DB but not when adding a feature on a map connected to the Feature Service. And Config Popups on the Feature Service map can't find the zipCode layer via $datastore? This works in the map connected to the database.
... View more
10-21-2020
05:09 PM
|
0
|
2
|
2762
|
POST
|
Michael Miller Config Pop-ups with scripts is great advice for saving time (I encourage my team to do this when possible)! For this application, we are storing zip code center points. I have tested the script in the pop-up and it works as expected.
... View more
10-21-2020
05:00 PM
|
0
|
3
|
2762
|
POST
|
I just noticed I am in fact getting the error when editing the feature service in Pro. Here is a screenshot of the script (also in text below). I tried to keep it as close to the ESRI example I referenced: //This calculation attribute rule is added to the shape field of a point feature class called pointClass2 var centerFeature = First(FeatureSetByName($datastore, "density.DBO.zipCodes")) //Get the x and y values of the feature in the pointClass1 var x0 = Geometry(centerFeature).x var y0 = Geometry(centerFeature).y //Get the x and y values of the current feature in the pointClass2 var x1 = Geometry($feature).x; var y1 = Geometry($feature).y; var x2 = 0; var y2 = 0; var d = 5 //Calculate the euclidean distance from feature in pointClass1 and current feature in pointClass2 var d1 = sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) //Calculate the new x and y to be within 5 metric units while maintaining slope x2 = (x1 - x0) * d / d1 + x0; y2 = (y1 - y0) * d / d1 + y0; //Create a point geometry from the new x and y values var pointA = Point({ "x": x2, "y": y2, "z": 0, "spatialReference": Geometry(centerFeature).spatialReference }); return pointA
... View more
10-21-2020
03:55 PM
|
0
|
5
|
2762
|
POST
|
Hi Xander Bakker, I thought the same thing about Pro/Portal/API all using REST to make edits. I've included a screenshot from Postman below. I've also tested other attribute rules on non-geometry fields and those update as expected using this method.
... View more
10-21-2020
02:48 PM
|
0
|
8
|
2762
|
POST
|
I used the example rule from this ESRI example to update the Shape field of features on insert. The rule works great when adding/updating features via Pro or Portal maps but not from applyEdits API call made to the ArcGIS Enterprise Feature Service end point. Is this a bug? ArcGIS Pro: 2.6 ArcGIS Enterprise 10.8.1 SQL Server ArcGIS Server Log Error:
... View more
10-20-2020
10:40 PM
|
0
|
10
|
3251
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|