<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Constraint Rule on Electrical Utility Network in ArcGIS Utility Network Questions</title>
    <link>https://community.esri.com/t5/arcgis-utility-network-questions/constraint-rule-on-electrical-utility-network/m-p/1092663#M1346</link>
    <description>&lt;P&gt;Thanks Johannes, that was what I was assuming.&amp;nbsp; I just disabled the rule for now and I can make edits appropriately.&amp;nbsp; I will also give your adjustments a try.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Aug 2021 12:56:59 GMT</pubDate>
    <dc:creator>LindseyStone</dc:creator>
    <dc:date>2021-08-26T12:56:59Z</dc:date>
    <item>
      <title>Constraint Rule on Electrical Utility Network</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/constraint-rule-on-electrical-utility-network/m-p/1092502#M1344</link>
      <description>&lt;P&gt;I'm getting the the below error message when attempting to apply a Rated KVA attribute to Medium Voltage Transformers.&amp;nbsp; This was a default constraint rule on devices with the Utility Utility Network Enterprise v1.&amp;nbsp; The only difference is I applied this to a Enterprise Server 10.8.1 instead of 10.9.1.&amp;nbsp; Does the arcade expression have an actual error or is because I'm applying it to an older server?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Assigned To: ElectricDevice
// Type: Constraint
// Name: ElectricDevice - Transformer kVA
// Description: Validates that the features kVA is valid based on the type of transformer
// Subtypes: All
// Error Number: 5702
// Error Message: Feature kVA is not valid
// Trigger: Insert, Update
// Exclude From Client: False
// Disable: False

// Related Rules: Some rules rely on additional rules for execution. If this rule works in conjunction with another, they are listed below:
//    - None

// Duplicated in: This rule may be implemented on other classes, they are listed here to aid you in adjusting those rules when a code change is required.
//    - None

// *************       User Variables       *************
// This section has the functions and variables that need to be adjusted based on your implementation

// 38 - Medium Voltage Transformer
// 39 - Medium Voltage Step Transformer
var valid_asset_groups = [38, 39];
var kva = $feature.ratedpower;

// ************* End User Variables Section *************

// *************       Functions            *************
function asset_type_to_kva(id) {
    return Decode(id,
        782, [5000, 10000, 15000, 25000, 37500, 50000],
        783, [45000, 75000, 112500, 150000, 225000, 300000, 500000, 750000, 1000000, 1500000, 2000000, 2500000, 3000000, 3750000, 5000000, 7000000, 7500000, 10000000],
        785, [5000, 10000, 15000, 25000, 37500, 50000, 75000, 100000, 167000, 250000, 333000, 500000],
        788, [30000, 45000, 75000, 112500, 150000, 225000, 300000],
        789, [5000, 10000, 15000, 25000, 37500, 50000, 75000, 100000, 167000, 250000, 333000],
        792, [45000, 75000, 112500, 150000, 225000, 300000, 500000, 750000, 1000000, 1500000, 2000000, 2500000, 3000000, 3750000, 5000000, 7000000, 7500000, 10000000],
        793, [25000, 37500, 50000, 75000, 100000, 167000],
        794, [150000, 225000, 300000, 500000, 750000, 2500000],
        801, [5000, 10000, 15000, 25000, 37500, 50000, 75000, 100000, 167000, 250000, 333000, 500000],
        null)
}

// *************       End Functions         *************
if (IsEmpty(kva)){
    return true;
}

if (!Includes(valid_asset_groups, $feature.assetgroup)) {
    return true;
}

// Find the valid values, if an entry was not found, null is returned
var valid_kva = asset_type_to_kva($feature.assettype);
if (IsEmpty(valid_kva)) {
    return true;
}
return Includes(valid_kva, kva)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="KVA Transformer Rule Error.JPG" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/21741iF8C87DF438BEB018/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KVA Transformer Rule Error.JPG" alt="KVA Transformer Rule Error.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 21:51:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/constraint-rule-on-electrical-utility-network/m-p/1092502#M1344</guid>
      <dc:creator>LindseyStone</dc:creator>
      <dc:date>2021-08-25T21:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint Rule on Electrical Utility Network</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/constraint-rule-on-electrical-utility-network/m-p/1092625#M1345</link>
      <description>&lt;P&gt;The expression uses the Includes() function, which is only available since Arcade 1.12 with ArcGIS Enterprise Server 10.9&lt;/P&gt;&lt;P&gt;You can do it the "old" way, which is more cumbersome:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Assigned To: ElectricDevice
// Type: Constraint
// Name: ElectricDevice - Transformer kVA
// Description: Validates that the features kVA is valid based on the type of transformer
// Subtypes: All
// Error Number: 5702
// Error Message: Feature kVA is not valid
// Trigger: Insert, Update
// Exclude From Client: False
// Disable: False

// Related Rules: Some rules rely on additional rules for execution. If this rule works in conjunction with another, they are listed below:
//    - None

// Duplicated in: This rule may be implemented on other classes, they are listed here to aid you in adjusting those rules when a code change is required.
//    - None

// *************       User Variables       *************
// This section has the functions and variables that need to be adjusted based on your implementation

// 38 - Medium Voltage Transformer
// 39 - Medium Voltage Step Transformer
var valid_asset_groups = [38, 39];
var kva = $feature.ratedpower;

// ************* End User Variables Section *************

// *************       Functions            *************
function asset_type_to_kva(id) {
    return Decode(id,
        782, [5000, 10000, 15000, 25000, 37500, 50000],
        783, [45000, 75000, 112500, 150000, 225000, 300000, 500000, 750000, 1000000, 1500000, 2000000, 2500000, 3000000, 3750000, 5000000, 7000000, 7500000, 10000000],
        785, [5000, 10000, 15000, 25000, 37500, 50000, 75000, 100000, 167000, 250000, 333000, 500000],
        788, [30000, 45000, 75000, 112500, 150000, 225000, 300000],
        789, [5000, 10000, 15000, 25000, 37500, 50000, 75000, 100000, 167000, 250000, 333000],
        792, [45000, 75000, 112500, 150000, 225000, 300000, 500000, 750000, 1000000, 1500000, 2000000, 2500000, 3000000, 3750000, 5000000, 7000000, 7500000, 10000000],
        793, [25000, 37500, 50000, 75000, 100000, 167000],
        794, [150000, 225000, 300000, 500000, 750000, 2500000],
        801, [5000, 10000, 15000, 25000, 37500, 50000, 75000, 100000, 167000, 250000, 333000, 500000],
        null)
}

// *************       End Functions         *************
if (IsEmpty(kva)){
    return true;
}

//if (!Includes(valid_asset_groups, $feature.assetgroup)) {
//    return true;
//}
for (var i in valid_asset_groups) {
    if(valid_asset_groups[i] == $feature.assetgroup) {
        return true;
    }
}

// Find the valid values, if an entry was not found, null is returned
var valid_kva = asset_type_to_kva($feature.assettype);
if (IsEmpty(valid_kva)) {
    return true;
}
//return Includes(valid_kva, kva)
for (var i in valid_kva) {
    if (valid_kva[i] == kva) {
        return true;
    }
}
return false;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 09:01:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/constraint-rule-on-electrical-utility-network/m-p/1092625#M1345</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-08-26T09:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint Rule on Electrical Utility Network</title>
      <link>https://community.esri.com/t5/arcgis-utility-network-questions/constraint-rule-on-electrical-utility-network/m-p/1092663#M1346</link>
      <description>&lt;P&gt;Thanks Johannes, that was what I was assuming.&amp;nbsp; I just disabled the rule for now and I can make edits appropriately.&amp;nbsp; I will also give your adjustments a try.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 12:56:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-utility-network-questions/constraint-rule-on-electrical-utility-network/m-p/1092663#M1346</guid>
      <dc:creator>LindseyStone</dc:creator>
      <dc:date>2021-08-26T12:56:59Z</dc:date>
    </item>
  </channel>
</rss>

