|
BLOG
|
I appreciate the work MVPs are doing here in the community, especially in the attribute rules section which is getting lots of traction thank you !
... View more
05-09-2023
10:51 AM
|
5
|
0
|
11450
|
|
POST
|
This bug will be addressed in 3.1.2 Please use BUG-000157390 for tracking.
... View more
05-09-2023
09:33 AM
|
0
|
0
|
1581
|
|
BLOG
|
Are you getting a field not found error, in 3.1 for an Attribute Rule that worked in previous ArcGIS Pro? The reason is because we fixed a bug in 3.1 with FeatureSetByName that were incorrectly requesting too many fields than requested. FeatureSetByName is a function that allows you to query a table and specify what fields to pull back and whether to return the geometry. The result then can be used in the Arcade script. Here is an example where we have a table `mytable` and we are pulling field1 and requesting not to return geometry. var fs = FeatureSetByName($datastore, "mytable", ["field1"], false);
var firstRow = first(fs);
return firstRow.field1; Due to a bug in Pro 3.0 and earlier, the software in certain conditions will ignore the requested fields and will return all fields including the geometries during Arcade validations and execution. This means that scripts that should have failed were working here is an example where you only returned field1 but the script is trying to access field2 but the featureset doesn't have it because it only asked for field1 var fs = FeatureSetByName($datastore, "mytable", ["field1"], false);
var firstRow = first(fs);
return firstRow.field2; //this should fail because field2 is not in the result set. In prior releases this bug masked these scripts errors and continue to work even when the script isn't correct. In Pro 3.1 Pro and Enterprise 11.1 always respect the requested fields and geometry. This is unfortunate because we know a lot of our users have scripts that might now fail in the Pro 3.1/11.1 but the good news is scripts will sure run faster consistently as the software will always make sure to request only the fields set by the user in all execution paths and across all database platforms. How to fix? Pro 3.1 and Enterprise 11.1 will show the line number in which the error is encountered, you can trace back which featureset it came from and make sure that the fields are included. In our example above we got the error on line 3. So we add field2 to the request list. var fs = FeatureSetByName($datastore, "mytable", ['field1', 'field2'], false);
var firstRow = first(fs);
return firstRow.field2; //this should fail because field2 is not in the result set.
... View more
05-04-2023
03:25 PM
|
4
|
2
|
1718
|
|
POST
|
Hey James FeatureSetByName you are only asking for the ZIP5 to be returned, but then you are attempting to access. the zipcode field. To fix this add the zipcode field. See if that helps. That is something we fixed in 3.1 where in some cases prior releases we were fetching all fields regardless of what you asked it to, which is why you script worked before but no longer does. var zip = FeatureSetByName($datastore, 'ZipCodes', ['ZIP5', 'zipcode'], true);
var intersectLayer = Intersects(zip, Geometry($feature));
if (Count(intersectLayer) > 0) {
var layer = First(intersectLayer);
return layer['zipcode'];
} else {
return null;
}
... View more
05-04-2023
03:18 PM
|
3
|
0
|
3601
|
|
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
|
3614
|
|
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
|
1051
|
|
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
|
849
|
|
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
|
2024
|
|
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
|
4363
|
|
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
|
1511
|
|
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
|
5364
|
|
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
|
596
|
|
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
|
1281
|
| Title | Kudos | Posted |
|---|---|---|
| 3 | 2 weeks ago | |
| 5 | 3 weeks ago | |
| 1 | 4 weeks ago | |
| 1 | 11-03-2025 12:32 PM | |
| 1 | 01-02-2025 06:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|