POST
|
Test went well. But I made a small change to the IF statements. It should be " If Not Empty" --> If (!IsEmpty()){} Here is the updated code: var atts = {
'phasesnormal': transf_phase,
'phasescurrent': transf_phase,
'phasessummer': transf_phase,
'phaseswinter': transf_phase,
'addpowerrating': closestf['Bayonet_fuse_rated_amp']
}
if(!IsEmpty(closestf['InstallationDate'])){
atts['installdate'] = closestf['InstallationDate']
}
if(!IsEmpty(closestf['TapDate'])){
atts['inservicedate'] = closestf['TapDate']
}
return {
'result': field_value,
'edit':[{
//updates the fuse feature attributes
'className': 'UN_MODEL_V34.MODEL_V34.ElectricDevice',
'updates': [{
'globalID': $feature.globalID,
'attributes': atts
}
}]
}]
}
}
... View more
10-08-2021
10:00 AM
|
0
|
0
|
3416
|
POST
|
Hi Josh, Your code looks like another way to avoid the error with lest code, and it should save me the work to find all the feature that were assigned the date "12/30/1899" and replace it with a field calculation process in the attribute table. I will test it and report back the result. Thanks.
... View more
10-08-2021
08:53 AM
|
0
|
1
|
3417
|
POST
|
I will test it and get back to yo with the result. Let me take the opportunity to see if you can take a look at this question that I posted about copying attachments with Arcade: Copy Pictures Taken with Field Maps to Utility Net... - Esri Community Thanks.
... View more
10-08-2021
08:23 AM
|
0
|
0
|
3421
|
POST
|
Hi Josh, Thanks for your answer. Below you can see the section of the code where the assignment is done and the returned dictionary is defined. Before this section the code is just finding the closest source feature, which is not related to the problem. As you can see, I'm updating multiple fields, hence the used of the dictionary. The IF statement is the workaround that I mentioned in the third paragraph of my original question. Below you can see images with the field view in ArcGIS Pro for the source class and the target class. // Extract fuse attributes from closest source feature
var fuse_addpowerrating = closestf['Bayonet_fuse_rated_amp'] // This is the fuse rated current
var fuse_installdate = closestf['InstallationDate'] // Fuse installation date
var fuse_inservice_date = closestf['TapDate'] // Fuse inservice date
var phasesnormal = transf_phase // Domain assign to field
var phasescurrent = transf_phase // Domain assign to field
var phasessummer = transf_phase // Domain assign to field
var phaseswinter = transf_phase // Domain assign to field
if (IsEmpty(fuse_installdate) || IsEmpty(fuse_inservice_date) ) {
fuse_inservice_date = null
fuse_installdate = null
}
// Return dictionary with the data to transfer to the target feature
return {
'result': field_value,
'edit':[
{
//updates the fuse feature attributes
'className': 'UN_MODEL_V34.MODEL_V34.ElectricDevice',
'updates': [{
'globalID': $feature.globalID,
'attributes': {
'phasesnormal': phasesnormal,
'phasescurrent': phasescurrent,
'phasessummer': phasessummer,
'phaseswinter': phaseswinter,
'addpowerrating': fuse_addpowerrating,
'installdate': fuse_installdate,
'inservicedate': fuse_inservice_date,
//'model': fuse_model
}
}]
}
]
}
} Source Feature Date Fields Target Feature Date Fields
... View more
10-08-2021
07:49 AM
|
0
|
3
|
3435
|
POST
|
Hi, I'm trying to transfer date data from a source feature class to a target feature class using an Arcade Dictionary to update the date field in the target class. Some of the features in the source class have blank\null value in the date field. When the rule finds one source features with a blank\null field it raises and error saying that the value passed by the dictionary to the field is not the right type. Even when the date field in the target is set to allow null values. Then, I found that setting the date field value in the dictionary explicitly to null will avoid the error, but the value was set to "12/30/1899" in the target date field. Why is not possible to set date field value to null using an Arcade Dictionary?
... View more
10-07-2021
07:19 PM
|
0
|
10
|
3856
|
POST
|
Hi, This is the configuration of my system: ArcGIS Enterprise 10.8.1 SQL Server 2017 ArcGIS Pro 2.8 Utility Network Version 4 We captured attribution and pictures of some assets using Field Maps using a dedicate feature layer, not part of the Utility Network dataset. Now we need to transfer the pictures taken with Field Maps to the corresponding Utility Network feature. Is this possible using Arcade? If not possible with Arcade, what could be another workflow to do this? Regards.
... View more
10-06-2021
05:34 PM
|
1
|
0
|
353
|
POST
|
Hi, Do the markup features created in Field Maps have a timestamp attribute? I exported the markup layer to ArcGIS Online and added to ArcGIS Pro, but attribute table for the markup layer doesn't show any timestamp data.
... View more
09-21-2021
01:19 PM
|
0
|
0
|
468
|
POST
|
Hi Johannes, Thanks for the answer. It makes sense. I think that the documentation should be more clear about this. In my process of trying to identify the source of the error, I notice that even if I change the global $map to $datastore, on line 20 of the code above, if I used a variable to input the class name ('source_layer') this will also trigger the error 999999. Only when I used the literal name of the class in the database the error was not triggered: var fsSource = FeatureSetByName($datastore, 'UN_MODEL_V34.MODEL_V34.Poles_to_Riser_Disconnect_Match',['*'], false)
... View more
09-20-2021
04:59 AM
|
0
|
1
|
1177
|
POST
|
Hi, This is my system configuration: ArcGIS Pro 2.8 Electric Utility Network Version 4 ArcGIS Enterprise 10.8.1 SQL Server 2017 I'm getting this error when trying to save the rule (error and code images at the end) to my enterprise geodatabase (Utility Network in SQL database). The problem seems to be related to the code in the rule because I could save other rules with different code after the error. I think it has to do with my using the $map global in the Attribute Rule Calculation profile. The Arcade documentation is a little confusing about using the $map global in this profile. In the Profile section of the documentation (Profiles | ArcGIS Arcade) it doesn't include the $map global, but the Type System FeatureSetCollection section (Type System | ArcGIS Arcade) of the documentation mentions that the $map global can be used in the Attribute Rules profiles. The other rules that I was able to save are using the $datastore global to access other class in the database. This rules is trying to access a feature class added to the map from a file geodatabase. I'm trying to avoid having to add the feature class in the file geodatabase to the enterprise geodatabase and then use $datastore global. This process has worked in the past, but now I'm having problems deleting those temporary feature classes from the enterprise geodatabase (Utility Network SQL database) when I don't need them anymore. So, what I'm trying to do is find a way to allow the Attribute Rule associated to a Utility Network feature class in the enterprise geodatabase to extract data from a feature class in a file geodatabase. I'm not sure if the $map global is the best way to do that. // ************* User Variables *************
// This section has the functions and variables that need to be adjusted based on your implementation
// The field the rule is assigned to
var field_value = $feature.notes;
var source_layer = 'Poles_to_Riser_Disconnect_Match';
var search_distance = 200;
var search_unit = 'feet';
var feat_globalid = $feature.globalID;
// Asset_type allowed
var valid_asset_types = [565]; // 565 - Overhead Cutout Fused Load Break from Device Class
// ************* End User Variables Section *************
// Checking for allowed asset types
if (indexof(valid_asset_types, $feature.assettype) == -1) {
return field_value;
}
//Find the closest pole
var fsSource = FeatureSetByName($map, source_layer,["*"], false)
var fBuffer = Buffer(Geometry($feature), search_distance, search_unit)
var fsClosest = Intersects(fsSource, fBuffer)
var minDistance = Infinity
var fFuse = First(fsClosest)
if (IsEmpty(closestp)) {
return field_value;
}
return fFuse['STREET']
... View more
09-15-2021
07:51 AM
|
0
|
3
|
1234
|
POST
|
Hi Michael, I stopped the service in Server Manager only. I didn't do anything on the machine running ArcGIS Server.
... View more
09-07-2021
04:47 AM
|
0
|
0
|
2431
|
POST
|
Hi, This is the configuration of our system: ArcGIS Enterprise 10.8.1 (Server, Portal, Web-Adaptor, Data Store, SQL; all running on independent VMs) SQL Server 2017 ArcGIS Pro 2.8 Utility Network Version 4 Below you can see the errors that I'm getting when I try to start a service associated with a Utility Network model. The table that is being reference in the error is part of the Utility Network model and is present in the database when I look in SQL Server, also when I connect directly to the database in ArcGIS Pro and consume it on a map I can see all the data and the associations that are in table [UN_6_Associations]. Therefore, the database has the table and the data is there. The problem began with 2 services that were already published and today I publish a new service ("Project_Service") from the same database, but I'm still getting the same error. Before the problem started I was trying to delete a feature class from the database associated with this services, this feature is not part of the utility network schema. I right click the feature class and clicked the delete option, but I got this error (see last image below) "Cannot get exclusive schema lock". Then I went to server manager an stopped the 2 services associated with the database. Tried to delete the feature class again wit the same result. I decided to call ESRI support, the analyst guided me into checking the locks on the database using Pro (Administration\Locks) and then try to disconnect the all the users; but the option was grayed-out. I'm the only one using this database and service in the company. I'm the only one with ArcGIS Pro access in the company. Then the analyst wanted me to check SQL Server. He sent me some queries to run and check the users connected to the database, but they returned empty. Finally he wanted me to check the rights of the database user in the security section of the database and we change one parameter there. After going back to Pro and getting the same result when trying to delete the feature class, the analyst said the he needed more time to look into the problem. That's when I tried to re-start the services and got the "DBMS table not found" error.
... View more
09-03-2021
06:56 AM
|
1
|
7
|
2496
|
POST
|
Hi Hussein, Thanks for the link to the blog, it was very useful. It looks like this blog is not part of the "Attribute Rules" forum because I did several searches before starting this question to see if there was a blog or previous questions related to this topic. After following the examples in the blog I was able to find that the problem with my original rule was that I was using the keyword "fromTerminal" instead of "toTerminal" to connect to the "SS:S2" terminal of the Fuse feature. Here is the correct code: // Assigned To: ElectricJunction
// Name: Proximity_Connectivity_Association
// Description: Upon insertion of an ElectricJunction of the allowed AssetTypes
// creates the connectivity association to the closest ElectricDevice MV Fuse or
// MV ElectricJunction Line End
// Subtypes: All
// Field: notes
// Execute: Insert
// Exclude from application evaluation: True
// ************* User Variables *************
// This section has the functions and variables that need to be adjusted based on your implementation
// The field the rule is assigned to
var field_value = $feature.notes;
var association_class = null;
var search_distance = 100;
var search_unit = 'feet';
var feat_globalid = $feature.globalID;
var valid_asset_types = [103]; // 103 = MV Line End\Riser
// ************* End User Variables Section *************
if (indexof(valid_asset_types, $feature.assettype) == -1) {
return field_value;
}
//Find the closest MV Fuse
var fsDevices = FeatureSetByName($datastore, 'UN_MODEL_V34.MODEL_V34.ElectricDevice',["GLOBALID"], false)
var fBuffer = Buffer(Geometry($feature), search_distance, search_unit)
var fsClosest = Intersects(fsDevices, fBuffer)
var fsFuses = Filter(fsClosest, 'ASSETTYPE = 565') //565 = MV Fuse\Overhead Cutout Fused Load Break
var minDistance = Infinity
if (Count(fsFuses) <= 0) {
var fsElecJunction = FeatureSetByName($datastore, 'UN_MODEL_V34.MODEL_V34.ElectricJunction',["GLOBALID"], false)
fsClosest = Intersects(fsElecJunction, fBuffer)
var fsLineEnd = Filter(fsClosest, 'ASSETTYPE = 100') //100 = MV Line End\Overhead Line End
if (Count(fsLineEnd) <= 0) {
return field_value
} else {
association_class = 'UN_MODEL_V34.MODEL_V34.ElectricJunction'
var closestle = null // closest MV Line End feature
for (var p in fsLineEnd) {
var pDistance = Distance(p, $feature, 'feet')
if (pDistance < minDistance) {
minDistance = pDistance;
closestle = p
}
}
}
} else {
association_class = 'UN_MODEL_V34.MODEL_V34.ElectricDevice'
var closestf = null // closest MV Fuse feature
for (var p in fsfuses) {
var pDistance = Distance(p, $feature, 'feet')
if (pDistance < minDistance) {
minDistance = pDistance;
closestf = p
}
}
}
if (!IsEmpty(closestf)) {
var assocation_update = [{'globalID': closestf.globalID, 'toTerminal': 'SS:S2' ,'associationType': 'connected'}];
} else if (!IsEmpty(closestle)) {
var assocation_update = [{'globalID': closestle.globalID, 'associationType': 'connected'}];
}else {
return field_value;
}
var edit_payload = [{'className': association_class, 'updates': assocation_update}];
return {
"result": field_value,
"edit": edit_payload
};
... View more
09-02-2021
09:51 AM
|
0
|
0
|
1283
|
POST
|
Hi Johannes, Thanks for your reply. The behavior without your suggestion is this: Code: if (!IsEmpty(closestf)) {
var assocation_update = [{'globalID': closestf.globalID, 'fromTerminal': 'SS:S2' ,'associationType': 'connected'}];
} else if (!IsEmpty(closestle)) {
var assocation_update = [{'globalID': closestle.globalID, 'associationType': 'connected'}];
}else {
return field_value;
}
var edit_payload = [{'className': association_class, 'updates': assocation_update}];
return {
"result": field_value,
"edit": edit_payload
}; Error message trying to Create Association between the Riser and the Fuse with terminals (line 2 of code above): Error in Pro: Successful when trying to Create Association between the Riser and the Line End (line 4 of the code above), and I'm not using the "attributes" keyword in the dictionary as you suggest: 2. Behavior with your suggestion to include the "attributes" keyword in the dictionary: Code: if (!IsEmpty(closestf)) {
var assocation_update = [{'globalID': closestf.globalID, 'attributes': {'fromTerminal': 'SS:S2' ,'associationType': 'connected'}}];
} else if (!IsEmpty(closestle)) {
var assocation_update = [{'globalID': closestle.globalID, 'associationType': 'connected'}];
}else {
return field_value;
}
var edit_payload = [{'className': association_class, 'updates': assocation_update}];
return {
"result": field_value,
"edit": edit_payload
}; Error message trying to Create Association between the Riser and the Fuse with terminals (line 2 of code above): Successful when trying to Create Association between the Riser and the Line End (line 4 of the code above), and I'm not using the "attributes" keyword in the dictionary as you suggest: My conclusion at this point is that the documentation explaining the syntax of the dictionary should be expanded with better examples on how to create the different associations (connectivity, attachment and containment) between the utility network features with and without terminal. Also, I'm not sure if I have to use the keyword "adds" or "updates". One of the examples in the arcade-expressions github page uses "adds" to create new association (https://github.com/Esri/arcade-expressions/blob/master/attribute_rule_calculation/CreateAssociation.md); the other uses "updates" (https://github.com/Esri/arcade-expressions/blob/master/attribute_rule_calculation/CreateAttachmentAssociationByProximity.md). Also, notice that none of these sample codes use the keyword "attributes" in the returned dictionary.
... View more
09-02-2021
06:19 AM
|
0
|
1
|
1297
|
Title | Kudos | Posted |
---|---|---|
1 | 04-05-2024 07:08 AM | |
1 | 09-03-2021 06:56 AM | |
1 | 10-16-2023 11:27 AM | |
1 | 10-16-2023 11:11 AM | |
1 | 10-06-2021 05:34 PM |
Online Status |
Offline
|
Date Last Visited |
05-30-2024
04:54 PM
|