POST
|
This one is really interesting, just found another issue when you have more than 6 features to update, because we have a limit of the number of Arcade engines the script hit that limit pretty soon. The only workaround to really fix this is to have an additional field, I added a field called isPush with a integer value. We want to essentially differentiate between a user update changing the pushvalue vs an automated attribute rule update. You can hide the ispush field from users as it will only be used by the attribute rule. if ($feature.ispush == 1) return {"result": {"attributes": {"ispush": 0}}}; Final script.. // calculed Field $feature.Helper
// Triggers: Insert, Update
// Exclude from application evaluation
//add base condition
if ($feature.ispush == 1) return {"result": {"attributes": {"ispush": 0}}};
if($originalFeature.pushvalue == $feature.pushvalue) return;
var GID = $feature.GemeindeID
var GLID = $feature.GlobalID
// filter current featureset except the feature that is edited rn
var SQL = "GemeindeID = @GID AND GlobalID <> @GLID"
var sirenen = FeatureSetByName($datastore, "Sirenen", ["*"])
var filterSirene = filter($featureset, SQL)
console(count(filterSirene))
var updates = []
for(var f in filterSirene) {
if(f.GlobalID == $feature.GlobalID) continue;
//don't update values that are the same to avoid recursion.
if(f.pushvalue == $feature.pushvalue) continue;
var u = {
globalID: f.GlobalID,
attributes: {
Pushvalue: $feature.Pushvalue,
ispush :1
}
}
Push(updates, u)
}
return {
result: {
attributes: {
Pushvalue: $feature.Pushvalue}
},
edit: [{
className: "Sirenen",
updates: updates
}]
}
... View more
03-08-2024
10:51 AM
|
1
|
3
|
217
|
POST
|
Ok I forgot to deal with one more thing which is when the value is the same don't even attempt the update. Tested this one locally and it worked. // calculed Field $feature.Helper
// Triggers: Insert, Update
// Exclude from application evaluation
//add base condition
if($originalFeature.pushvalue == $feature.pushvalue) return;
var GID = $feature.GemeindeID
var GLID = $feature.GlobalID
// filter current featureset except the feature that is edited rn
var SQL = "GemeindeID = @GID AND GlobalID <> @GLID"
var sirenen = FeatureSetByName($datastore, "Sirenen", ["*"])
var filterSirene = filter($featureset, SQL)
console(count(filterSirene))
var updates = []
for(var f in filterSirene) {
if(f.GlobalID == $feature.GlobalID) continue;
//don't update values that are the same to avoid recursion.
if(f.pushvalue == $feature.pushvalue) continue;
var u = {
globalID: f.GlobalID,
attributes: {
Pushvalue: $feature.Pushvalue
}
}
Push(updates, u)
}
return {
result: {
attributes: {
Pushvalue: $feature.Pushvalue}
},
edit: [{
className: "Sirenen",
updates: updates
}]
}
... View more
03-08-2024
10:16 AM
|
1
|
4
|
221
|
POST
|
Yeah your rule will trigger forever, just like in recursion you will need a base condition for your attribute rule. And that is if pushvalue is the same, just no-op. // calculed Field $feature.Helper
// Triggers: Insert, Update
// Exclude from application evaluation
//add base condition
if($originalFeature.pushvalue == $feature.pushvalue) return;
var GID = $feature.GemeindeID
var GLID = $feature.GlobalID
// filter current featureset except the feature that is edited rn
var SQL = "GemeindeID = @GID AND GlobalID <> @GLID"
var sirenen = FeatureSetByName($datastore, "Sirenen", ["*"])
var filterSirene = filter($featureset, SQL)
console(count(filterSirene))
var updates = []
for(var f in filterSirene) {
if(f.GlobalID == $feature.GlobalID) { continue }
var u = {
globalID: f.GlobalID,
attributes: {
Pushvalue: $feature.Pushvalue
}
}
Push(updates, u)
}
return {
result: {
attributes: {
Pushvalue: $feature.Pushvalue}
},
edit: [{
className: "Sirenen",
updates: updates
}]
} also for additional optimization (although you might have done on purpose for Editor tracking), add a filter to your sql to only push the different var pushValue = $feature.pushvalue
var SQL = "GemeindeID = @GID AND GlobalID <> @GLID AND pushvalue <> @pushValue"
... View more
03-07-2024
08:16 AM
|
0
|
6
|
253
|
BLOG
|
Thanks @Bud I used file just to support older Pro releases, That being said, I just tried to upload a row mobilegdb but got an error (content type octet stream doesn't match file extension .geodatabase), the change might take time to fully propagate
... View more
02-27-2024
09:15 AM
|
1
|
0
|
221
|
POST
|
There isn't an out of the box way to do it but you can script it with an options table as I show here https://community.esri.com/t5/attribute-rules-blog/how-to-toggle-constraint-and-calculation-attribute/ba-p/1387438
... View more
02-27-2024
07:38 AM
|
1
|
0
|
182
|
IDEA
|
There isn't an out of the box way to do it but you can script it with an options table as I show here https://community.esri.com/t5/attribute-rules-blog/how-to-toggle-constraint-and-calculation-attribute/ba-p/1387438
... View more
02-27-2024
07:35 AM
|
0
|
0
|
221
|
BLOG
|
We hear this requirement very often from customers in geonet and the conferences; Is there a way to temporarily disable all immediate attribute rules? While out of the box there isn't a way to do that as it requires changing the schema (physically disabling each rule and stopping any services), I thought I'd share a workaround for users who really want to implement this in their system. By adding an "options" table with a column EnableAR, we can have each rule before it executes checks this table and reads the value at runtime. If the value is 0 the rule immediately returns, if the value is 1 the rule logic executes as normal. I made an example here (attached) and a video to demonstrate With this approach you can quickly toggle all attribute rules execution and you can even control what type rules you want to enable and disable. The downside of this is you have to update all your rules to start using this check, but once you do you are good to go. The other thing to watch out for is in multi-user environment one user can toggle this option to disable the rule and post it to DEFAULT effectively disabling the rules for all users which is something you might not want. You can of course add additional checks to prevent this logic in DEFAULT using the gdbVersion function. Filegdb with code attached
... View more
02-27-2024
07:34 AM
|
2
|
3
|
380
|
POST
|
Thanks I can reproduce it looks like a bug when the association is being added in multiple payloads, we will take a look. Meanwhile the workaround is to group all associations in one payload. return {
"edit": [
{
"className" : "ElectricDistributionJunctionObject",
"adds" : [{
"tag": "unit1",
"attributes": {
"assetgroup": 2,
"assetType": 1}
}]},
{
"className": "^UN_Association",
"adds": [{
"fromClass": "ElectricDistributionJunctionObject",
"fromGlobalId": $feature.GLOBALID,
"toClass": "ElectricDistributionJunctionObject",
"toGlobalId": "unit1.globalID",
"associationType": "containment"
},
{
"fromClass": "ElectricDistributionJunctionObject",
"fromGlobalId": $feature.GLOBALID,
"toClass": "ElectricDistributionJunctionObject",
"toGlobalId": "unit1.globalID",
"fromTerminal": "Source",
"associationType": "connectivity"
},
{
"fromClass": "ElectricDistributionJunctionObject",
"fromGlobalId": $feature.GLOBALID,
"toClass": "ElectricDistributionJunctionObject",
"toGlobalId": "unit1.globalID",
"fromTerminal": "Load",
"associationType": "connectivity"
}
]},
]
}
... View more
02-19-2024
10:25 AM
|
0
|
1
|
214
|
POST
|
No known issues in 3.2, all scripts should just work. Looking at the code I see you are using a variable LBCode where it is not defined, this might be a bug in 3.1 that we fixed in 3.2 (we start detecting undefined variables), you might have meant to use attributeValue instead. thanks I would suggest for performance avoiding using the count here and just do first and check for null and only ask for you are using. here is the rewritten script with the LBCode fixed. var intersectLayer = FeatureSetByName($datastore, "Lsgd_Boundary", ['LBCode'], false);
var attributeName = 'LBCode';
var intersectingFeatures = Intersects(intersectLayer, $feature);
var intersectedFeature = First(intersectingFeatures);
if (intersectedFeature == null) return 'NA';
var attributeValue = intersectedFeature[attributeName];
// Generate a unique sequence number
var id = NextSequenceValue("uniqueid");
// Concatenate LBCode and the unique sequence number
var projectID = attributeValue + "-" + id;
return projectID;
... View more
12-27-2023
08:38 AM
|
1
|
2
|
479
|
POST
|
Good question and yes that is the split contract as we have written it for consistency . The longer piece gets the "update" of the geometry while the shorter one gets to be inserted that is why the shorter one gets the new ID because that is where the logic to generate id lives.
... View more
11-01-2023
03:04 PM
|
0
|
0
|
413
|
POST
|
hey Katherine i see this is a direct connect sde connection, can you try on a filegdb and see if you see the same behavior? and also is it possible to send a data (with just one "bad" polygon) that reproduces feel free to take any fields/ data that is not relevant. your code looks correct so my guess it might be the spatial reference ..
... View more
09-08-2023
12:30 PM
|
0
|
1
|
793
|
POST
|
So you want to add a constraint rule on the attachment table that says something like this if ($feature.DATA_SIZE > 1000) return false;
return true;
... View more
09-07-2023
12:26 PM
|
0
|
1
|
414
|
POST
|
Hey Carlos Do you know version of Pro are you using for this (and is this filegdb or mobilegdb?) Is this a relationship? or something you maintain manually if it is relationship we have fixed few bugs with attribute rules eventing and patched them to 2.9.10/3.0.6 and 3.1.3 make sure you are using those. I'm attaching a sample for insert/update and delete. This is a pole feature that is related to an inspection table. (one pole has many inspections), every time you add an inspection record the count of inspections (a field on the pole) gets updated. if you delete it gets updated accordingly, this only work with the fixes in the patches mentioned.
... View more
08-29-2023
07:14 AM
|
0
|
1
|
394
|
POST
|
Hey Kade, this bug is a known issue that has been fixed in 11.1 and ported back to 10.9.1 Patch 5 (ArcGIS Server 10.9.1 Utility Network and Data Management Patch 5) Can you try on those platforms if possible? If you feel this need to be ported back to 11.0 you may contact support and request a hotfix bug reference BUG-000160904 thanks
... View more
08-24-2023
10:15 AM
|
0
|
0
|
409
|
POST
|
certainly! c is a variable, and when we say c++ this translate to add 1 to the value of c this whole thing is for us to start building a payload so essentially each tree gets its own payload tree 0 -> payload 0 tree 1-> payload 1 etc... and so on..
... View more
08-24-2023
09:15 AM
|
1
|
0
|
478
|
Title | Kudos | Posted |
---|---|---|
1 | Thursday | |
1 | 2 weeks ago | |
1 | 08-08-2022 10:29 AM | |
1 | 03-11-2024 01:09 PM | |
1 | 03-08-2024 10:51 AM |
Online Status |
Online
|
Date Last Visited |
2 hours ago
|