|
POST
|
That code should not pass validation, try this. var key_value = $feature["KeyField"]
// search for related features in point feature layer
var points= FeatureSetByName($datastore, "pointlayer", ["UpdateField"], false)
var filtered_fc = Filter(points, "KeyField = @Key_value")
var first_feat = First(filtered_fc);
// if no related features found
if(IsEmpty(first_feat)) {
return null
}
// related feature(s) found -> return UpdateField of the first one
return first_feat["UpdateField"]
... View more
01-16-2024
12:41 PM
|
0
|
1
|
2255
|
|
POST
|
Here is the code to copy the feature Expects($feature, '*');
var source_et_fields = ['created_user', 'created_date', 'last_edited_user', 'last_edited_date'];
var assoc_et_fields = ['CREATOR', 'CREATIONDATE', 'UPDATEDBY', 'LASTUPDATE'];
var system_prefix = 'orig';
var assoc_fs = FeatureSetByName($datastore, 'main.UN_6_Associations', ['*'], false);
// The field map defines the source to target fields, if this is an empty dict, it will be calculated on the fly
// for performance reasons, you may want to fill this out, but it would have to be maintained as you update your schema
// This code can generate the static field map and display it in the console;
var source_target_field_map = {};
var assoc_field_map = {};
// Feature must be out of service and abandoned
var process_when = {'Lifecyclestatus': [0]};
// Once a feature is abandon, we only want to add an abandon row if the values that we are monitoring changed.
var one_field_did_change = False;
for (var field in process_when) {
var field_valid = false;
for (var i in process_when[field]) {
var val = process_when[field][i];
if (val == null && IsEmpty($feature[field]) ) {
if ($originalFeature[field] != $feature[field]){
one_field_did_change = true;
}
field_valid = true;
break;
} else if ($feature[field] == val || Text($feature[field]) == val) {
if ($originalFeature[field] != $feature[field]){
one_field_did_change = true;
}
field_valid = true;
break;
}
}
if (!field_valid){
return
}
}
if (!one_field_did_change){
return
}
function IsEmptyButBetter(data) {
if (IsEmpty(data)) return true;
for (var x in data) return false;
return true;
}
function build_field_map(source_schema, target_schema, system_fields, system_field_map_prefix) {
console('Field Map');
console('------------------------------------');
var source_lookup = [];
var target_lookup = [];
var field_map_local = {};
var source_fields = source_schema['fields'];
// Add the GlobalID and ObjectID fields to the list of ET fields for all the system fields
var local_source_et_fields = [];
for (var i in system_fields) {
Push(local_source_et_fields, Lower(system_fields[i]));
}
Push(local_source_et_fields, Lower(source_schema['objectIdField']));
Push(local_source_et_fields, Lower(source_schema['globalIdField']));
for (var i in source_fields) {
var field_info = source_fields[i];
var field_name = Lower(field_info['name']);
// Do not store the oid, globalid or ET info in the lookup, will be handled separately
if (Includes(local_source_et_fields, field_name)) {
continue;
}
Push(source_lookup, field_name);
}
var target_fields = target_schema['fields'];
for (var i in target_fields) {
var field_info = target_fields[i];
// We cannot map input to non editable target fields, such as shape_length, validationstatus
if (!field_info['editable']){
continue
}
var field_name = Lower(field_info['name']);
Push(target_lookup, field_name);
if (Includes(source_lookup, field_name)) {
console(`'${field_name}': '${field_name}',`);
field_map_local[field_name] = field_name;
}
}
if (system_field_map_prefix == '' || system_field_map_prefix == null) {
console('End Field Map');
console('------------------------------------');
console(' ');
return field_map_local;
}
for (var i in local_source_et_fields) {
var field_name = local_source_et_fields[i];
var target_field = Lower(`${system_field_map_prefix}_${field_name}`);
if (Includes(target_lookup, target_field)) {
console(`'${field_name}': '${target_field}',`);
field_map_local[field_name] = target_field;
}
}
console('End Field Map');
console('------------------------------------');
console(' ');
return field_map_local;
}
// If the field map was not defined, use the schema to build a dict of source to target field
if (IsEmptyButBetter(source_target_field_map)) {
var target_schema = Schema(FeatureSetByName($datastore, 'main.ABElectricDistributionDevice', ['*'], false));
var source_schema = Schema($feature);
source_target_field_map = build_field_map(source_schema, target_schema, source_et_fields, system_prefix);
}
if (IsEmptyButBetter(assoc_field_map)) {
var target_schema = Schema(assoc_fs);
var source_schema = Schema(FeatureSetByName($datastore, 'main.UN_6_Associations', ['*'], false));
assoc_field_map = build_field_map(source_schema, target_schema, assoc_et_fields, system_prefix);
}
// Use the field map to copy the attributes from the current feature to the abandon layer
var target_atts = {};
for (var source_field in source_target_field_map) {
target_atts[source_target_field_map[source_field]] = $feature[source_field];
}
// Create the return edits dict. Add Geometry for FeatureClasses
var abandon_row = {"attributes": target_atts};
var geo = Geometry($feature);
if (!IsEmpty(geo)) {
abandon_row['geometry'] = geo;
}
// Query the Association table to get all associations, use the field map to copy to copy the attributes from the current feature to the abandon layer
var feat_guid = $feature.globalid;
var filtered_fs = Filter(assoc_fs, 'FROMGLOBALID = @feat_guid or TOGLOBALID = @feat_guid');
// Loop over the associations, using the field map to create the list of adds
var assoc_rows = [];
for (var row in filtered_fs) {
var assoc_atts = {};
for (var assoc_field in assoc_field_map) {
assoc_atts[assoc_field_map[assoc_field]] = row[assoc_field];
}
var assoc_row = {"attributes": assoc_atts};
Push(assoc_rows, assoc_row);
}
var return_dict = {
"edit": [{
"className": 'main.ABElectricDistributionDevice',
"adds": [abandon_row]
}
]
};
if (Count(assoc_rows) > 0) {
Push(return_dict['edit'],
{
"className": 'main.ABAssociations',
"adds": assoc_rows
});
}
return return_dict; Here is the code on the abandon layer in a batch calc rule if ($feature.AB_BYPASS != 0)
{
return;
}
return {
"result": 1,
"edit": [{
"className": "main.ElectricDistributionDevice",
"deletes": [{
"objectID": $feature.ORIG_OBJECTID
}
]
}
]
}
... View more
01-16-2024
09:46 AM
|
1
|
0
|
3118
|
|
POST
|
We just finished a prototype of an Attribute Rule to lay down a set of classes to store abandoned assets and a set of attributes rules to move features to these classes and remove the abandoned assets. If you want to test it out, try out the atbx here - https://github.com/Esri/Utility-Data-Management-Support-Tools/tree/Preview3.1.2 The GP tool is in the Attribute Rules toolset, call Create Abandon Classes.
... View more
01-16-2024
05:04 AM
|
1
|
2
|
4263
|
|
POST
|
That domain was used in previous versions, but was removed. I will log an issue to get the map corrected
... View more
01-16-2024
04:49 AM
|
1
|
1
|
2391
|
|
POST
|
It looks like it is trying to publish the dirty area table, which I would say is a bug. Best thing to do it delete the UtilityNetwork, since ArcGIS Online does not support the Utility Network
... View more
01-16-2024
04:43 AM
|
0
|
0
|
1695
|
|
POST
|
Those switches where not selected in your trace results. My guess is they are not connected to the network. Can you run a find connected trace and see if they are returned? If they are not, check the line to ensure there is a vertex at that switch location and that vertex is at the same XYZ as the switch.
... View more
01-16-2024
03:53 AM
|
0
|
8
|
3623
|
|
POST
|
We provide links to the data dictionary on solution Use pages MikeMillerGIS_0-1705405728559.png https://solutions.arcgis.com/utilities/data-dictionary/index.html?cacheId=1498228375674fd99dbcd0225498b130&rsource=https%3A%2F%2Flinks.esri.com%2FElectricUtilityNetworkFoundation%2FDataDictionary%2Fv2.1
... View more
01-16-2024
03:49 AM
|
0
|
0
|
3004
|
|
POST
|
You need to return hasValue. I never used an Iif that way, not sure it will work either Try: hasValue= IIF(IsEmpty(unitNumber),"No", "Yes") return hasValue
... View more
01-15-2024
01:27 PM
|
1
|
0
|
1479
|
|
POST
|
You need to publish it to ArcGIS Enterprise. Publishing to ArcGIS Online will copy the data into ArcGIS Online and out of your SQL Server DB. Is this what you want to do?
... View more
01-14-2024
10:25 AM
|
1
|
1
|
1718
|
|
POST
|
We just finish a tool that creates an attribute that does exactly what you want. Download the toolbox at the end of this post(Note only works with the UN at the moment, but the result AR could be made to work with non UN classes) - Open Pro, navigate to the toolbox and expand Attribute Rules - Open Create Abandon Classs - Select the classes you wish to abandon/retire features from - Specify the field and the value that will trigger the movement/abandonment - This creates an AR on the selected classes and creates the class to copy the result to - You cannot delete the updated feature, as the AR fires in the middle of an update edit, and deleting the features causes issue in the database - We use a batch calculate AR on the abandon classes to delete the inactive rows in the source https://github.com/Esri/Utility-Data-Management-Support-Tools/tree/Preview3.1.2 UtilityDataManagementSupport.atbx
... View more
01-14-2024
10:12 AM
|
0
|
5
|
3145
|
|
POST
|
What settings are you selecting when you publish? It looks like you selected Vector Tile, you want to check Map Image/Feature MikeMillerGIS_0-1704895776173.png
... View more
01-10-2024
06:09 AM
|
0
|
1
|
1800
|
|
POST
|
You need to pass back a complete geometry object. So copy your geoemtry(can do this by calling Dictionary(geo) on it, prior to 3.2, you need to call Dictionary(Text(geo))). Modify the Z and then pass that dict into the geometry constructor.
... View more
01-02-2024
09:07 AM
|
0
|
1
|
1764
|
|
POST
|
The tool is more for data migration. The Attribute Rule is used as you edit, so you only have to look at terminals in situations where it cannot figure it out.
... View more
12-20-2023
07:45 AM
|
2
|
0
|
2056
|
|
POST
|
You can def use the Attribute Rule you linked, but the tool you are looking for is here: https://doc.arcgis.com/en/arcgis-solutions/latest/tool-reference/utility-network-package/modify-terminal-connections.htm
... View more
12-20-2023
07:40 AM
|
1
|
0
|
2072
|
|
POST
|
Are you trying to apply to an existing UN that an Asset Package was already applied to? I see you have a map in your project, can you try with a project with no maps? What version of ArcGIS Pro?
... View more
12-15-2023
11:00 AM
|
0
|
0
|
1367
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 1 | 2 weeks ago | |
| 1 | 3 weeks ago | |
| 2 | 07-07-2026 06:45 AM | |
| 1 | 06-26-2026 09:15 AM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|