|
POST
|
Hello, let me add context to why you are getting this object not found error at least in this particular case. Simplifying the script you have to the following there is a condition that when met, you define a variable inside the if block and set it to a value. Later outside the scope of the if block you do another if and use that variable. This is variable scoping, the variable isLeft will only be defined if the first condition is met Now if the first condition was not met, the variable isLeft will never be defined and the second if will fail with isLeft object is error. This is because Arcade has inherited its behavior from Javascript. Why did this work in 3.0 and not in 3.1? Well I could argue that the script may also fail in 3.0 or any release as well if $feature happened to not satisfy the first condition which leads to the variables to not getting defined. I think you can reproduce this in 3.0 by creating a feature outside Test_Jurisdictions. So the real solution for more predictable script is to define the scripts outside the scope. that is move isLeft and IsRight so they are at global scope if you are planning to use them across the script. If there are any other cases where the script fail but the syntax looks correct please post it in the this thread and we will take a look. Hope that clarifies it. Thank you and apologies for the late reply.
... View more
05-04-2023
11:17 AM
|
2
|
2
|
3475
|
|
POST
|
I see that you already implemented the change requested by Mike but still get the same behavior as you illustrated on another post. My guess since you are using 10.7.1 it could be a bug that we fixed in the next releases. Try the following script as a workaround // get the feature with the highest id
var m = FeatureSetByName($datastore,'oncf.dgf.urb_projet', ['*']);
//remove $feature from the equation.
var oid = $feature.objectid
var s= filter(m, "code_urb like 'URB%' AND objectid <> " + oid)
var max_feature = First(OrderBy(s, "code_urb DESC"))
// get the number of that id
var max_number = 0
if(max_feature != null) { // no features in featureset? -> this block is skipped and max_number is 0
var txt = Replace(max_feature.code_urb, "URB", "")
max_number = Number(txt)
}
// calculate and return the new id
return "URB" + Text(max_number + 1, "00000") ound
... View more
04-04-2023
08:16 AM
|
0
|
1
|
977
|
|
POST
|
If you use FeatureSetByname with $datastore and exclude the rule from application evaluation, the rule should work on the server as long as the container (assembly I assume?) is in the workspace which it should be in case of the UN. if those are related with containment associations you can use FeatureSetByAssociation https://www.esri.com/arcgis-blog/products/utility-network/data-management/featuresetbyassocaitions-new-utility-network-arcade-api-to-work-with-associations-2-5-10-8/
... View more
03-17-2023
10:37 AM
|
1
|
0
|
806
|
|
BLOG
|
On March 8th 2023 Dev Summit Plenary my colleague Anne Fitz and I delivered a talk on the power of Arcade language. I did an attribute rules demo where I showed how you can service water to homes with a single click which creates all laterals, fittings and services to the homes and update the attributes accordingly. Many of you requested the script so I'm putting this together this quick post to share it. My colleague Mike Miller is the original author of the base script that I took and extended. The script can be found here along side rich collection of examples in this repo. https://github.com/Esri/arcade-expressions/blob/master/attribute_rule_calculation/CreateLateralDevSummitPlenary2023.md
... View more
03-09-2023
08:24 AM
|
10
|
1
|
1969
|
|
POST
|
@JohannesLindner Can you try the filegdb case with Pro 3.1 Beta if you have access? We have a known issue where Arcade might sometime fetch all the fields even a subset is provided.
... View more
02-06-2023
07:05 AM
|
0
|
3
|
4175
|
|
POST
|
Your expectation is correct. Evaluate with changes - in version option should only evaluate features updated/inserted in the version. We were able to reproduce locally and this seems to be a bug in Pro where if you close or minimize the error inspector the options won't persist while the UI continue to show you that it did. We will try to address this in the next 2.9 patch. As a workaround 1) Switch to your version 2) Remove the error layers 3) Close the error inspector 3) Save and close pro 4) Open the project back, Add error layer, then open the error inspector make sure the error inspector is on docked (not auto-hide) 5) Select the modify in version option and evaluate, should work.
... View more
01-26-2023
01:53 PM
|
1
|
0
|
1438
|
|
POST
|
Hey Joel, what was causing is DeserializeEvaluateParams is a bug in Pro causing Evaluate to send a very large payload when def queries or subtype group layers are in the map. This bug was fixed in Pro 3.1, ported back to 2.9.6 and will also be included in 3.0.4 for reference BUG-000153528
... View more
01-25-2023
10:54 AM
|
2
|
0
|
5011
|
|
POST
|
Hey Stefan, this is a known issue in 2.9.x , we introduced Length3D in 2.9 but a bug caused it not to get added to the list or getting syntax highlighting. We fixed that in 3.0 The function should work normally otherwise.
... View more
12-22-2022
09:39 AM
|
1
|
0
|
557
|
|
POST
|
It is not recommended to change the $feature attributes through edit dictionary, the AR loses context and you can get into cyclic triggers and infinite loops. No different than recursion in programming. Instead, set the field type to null and use the result dictionary object, this way we are able to update the attributes of the new feature in row buffer and flush it once to the database. After rewriting your attribute rule with this mind it works. I just changed asset_number to labeltext which is the field i had on my UN (see gif) // MV Connector Line (Verbindingskabel) whithout Containment -> MV Substation
if (($feature.labeltext == "associate")) {
var update_class = 'ElectricDistributionLine'
var update_class_asso = 'ElectricDistributionAssembly'
var filterAssembly = ""
var boundaries = FeatureSetByName($datastore, "StructureBoundary", ["globalid"], true);
if (isempty(boundaries)) {
return;
//{"errorMessage": "Error 1"};
};
var intersectBoundaries = Intersects(boundaries, $feature);
if (isempty(intersectBoundaries)) {
return;
//{"errorMessage": "Error 2"};
};
var structureBoundary = First(intersectBoundaries);
if (isempty(structureBoundary)) {
return;
//{"errorMessage": "Error 3"};
}
var AllAssemblys = FeatureSetByName($datastore, "ElectricDistributionAssembly", ["assetgroup", "globalid"], true);
if (isempty(AllAssemblys)) {
return;
//{"errorMessage": "Error 4"};
}
var XYassembly = Filter(AllAssemblys, filterAssembly)
if (isempty(XYassembly)) {
return;
//{"errorMessage": "Error 5"};
};
var intersectAssembly = Intersects(XYassembly, structureBoundary);
if (isempty(intersectBoundaries)) {
return;
//{"errorMessage": "Error 6"};
};
var assemblyGeo = First(intersectAssembly)
if (isempty(assemblyGeo)) {
return;
//{"errorMessage": "Error 7"};
}
return {
"result": {
"attributes": {
"labeltext": "test"
}
},
"edit": [{
"className": update_class_asso,
"updates": [{
"globalid": assemblyGeo.globalid,
"associationType": "container"
}]
}]
}
}
... View more
12-12-2022
11:50 AM
|
0
|
1
|
1196
|
|
POST
|
You need to have an exit condition, Attribute rules in this case is no different than recursive function. If you are updating object 3833, with value "Bem 3833", you might want to do a check first before doing the update. If the value is good exit the script else continue var dangleDistance = 1000;
var feature_ = $feature;
//query objectid 3833
var fs1 = Filter($featureset, "objectid = 3833 AND BEMERKUNG = 'Bem 3833'");
var f = First(fs1);
//if is null, means feature 3833 doesn't have the value Bem 3833.. contiue to update.
//if is NOT null, it means the value already there, just exist
if (f != null)
return; //quit the script
//else update the feature
return {
"result" : {
"attributes": {
"BEMERKUNG": "test 23"
}
},
"edit": [{
"className": "HydroEdgePro",
"updates": [{
"objectID": 3833,
"attributes": {
"BEMERKUNG" : "Bem 3833"
}
}]
},{
"className": "arcade_log",
"adds": [{
"attributes": {
"Value": "test"
}
}]
}]
}
... View more
11-21-2022
08:47 AM
|
0
|
0
|
2366
|
|
POST
|
When you create a feature in the geodatabase it goes into a memory buffer for performance reasons. Additional updates to the feature by its object id will go to the buffer and then finally flushed at one swoop to the database. This is what happened in your first rule, you created the feature, then asked AR to update the same feature field BEMERKUNG to "Test 2". The AR found that the feature is still in memory and updated the field in memory then flushed it to the database. So the database only saw one insert. However we can't always do this optimization. This optimization is not performed when a query against the class happens, because the query must see the feature being created (basic database semantics), so when a query happens to the class (that is your second rule where you did a count of the class), we had to flush the inserted feature to the database. Then the AR says wait a minute, we need to update the same feature (that is your return dictionary with objectId), that update actually becomes a physical second update which triggers the attribute rule again, and we go into the infinite cycle. So as a better practice, the attribute rule need to be written in a predictable way, if you want to updates fields in the same feature use the return "result" dictionary, with this we have knowledge in the AR to update the same row. Hope that clarifies it.
... View more
11-17-2022
08:52 AM
|
0
|
0
|
2386
|
|
POST
|
It seems that the feature triggers a rule that updates itself that triggers, which then retriggers the same attribute rule leading to an infinite loop and thus this error. If you want to update attributes in the same feature you can use the result keyword instead of updates. return {
"result": {
"attributes": {
"BEMERKUNG": "test 2" //this update goes to the $feature
}
},
"edit": [ {
"className": "arcade_log",
"adds": [{
"attributes": {
"Value": "test"
}
}]
}]
}
... View more
11-15-2022
08:05 AM
|
1
|
2
|
2408
|
|
POST
|
Edit: And @JohannesLindner spotted it before I did, to consume the geometry of a feature that has been queried, the featureset should be created with return geometry set to true. It is a good practice to always check for null when you call `first`, First can return null if the featureset is empty, which can cause subsequent code to fail. And just to be safe, because the error is pointing in line 18 the geometry of the line might be null here so add a check for that too. var line = first(x)
//check if line is null
if (line == null) return; //do nothing
var geom = Geometry(line)
if (is_empty(geom )) return; //check if the geometry is null Now to explain "well it worked in 2.9 why does it fail in 3.0". To validate an Arcade script , AR picks a row in the table and makes that row $feature to do the validation against. It could be the case the 2.9 gives a different row than 3.0 and resulting in a failure in your script.
... View more
10-18-2022
01:05 PM
|
1
|
1
|
1118
|
|
POST
|
As long as your rule is NOT excluded from client evaluation (there is a checkbox on the rule, leave it unchecked) and you have auto apply turn off (which is the default) then the attribute editor should not rollback the changes and will give the user the ability to fix their mistake. This means that edits are not sent to the database and processed locally in the attribute editor pane. your rule should also have return true; at the end otherwise it will always fail.
... View more
10-18-2022
08:50 AM
|
1
|
0
|
3373
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-03-2025 12:32 PM | |
| 1 | 01-02-2025 06:31 AM | |
| 4 | 09-03-2025 12:49 PM | |
| 1 | 08-27-2025 10:23 AM | |
| 2 | 08-12-2025 11:01 AM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|