<?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>idea Quick way to Enable/Disable Attribute Rules at Database level in Attribute Rules Ideas</title>
    <link>https://community.esri.com/t5/attribute-rules-ideas/quick-way-to-enable-disable-attribute-rules-at/idi-p/1216920</link>
    <description>&lt;P&gt;Good day,&lt;BR /&gt;&lt;BR /&gt;It would be nice to be able to disable/enable all Attribute Rules at the database level.&lt;BR /&gt;&lt;BR /&gt;When rules are present in database, and we have a workflow to create parcels from CAD lines, we don't necessarily know all the rules that are in the database we are working in. We don't want any rules to interfere with our "creation" process until it's time to "save", then we want the rules to apply.&lt;BR /&gt;&lt;BR /&gt;If we could at the beginning of our workflow "disable" all attribute rules, then at the end of it, enable them back.&lt;/P&gt;&lt;P&gt;That would be great!&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;/P&gt;</description>
    <pubDate>Wed, 28 Sep 2022 13:53:37 GMT</pubDate>
    <dc:creator>PascalVezina</dc:creator>
    <dc:date>2022-09-28T13:53:37Z</dc:date>
    <item>
      <title>Quick way to Enable/Disable Attribute Rules at Database level</title>
      <link>https://community.esri.com/t5/attribute-rules-ideas/quick-way-to-enable-disable-attribute-rules-at/idi-p/1216920</link>
      <description>&lt;P&gt;Good day,&lt;BR /&gt;&lt;BR /&gt;It would be nice to be able to disable/enable all Attribute Rules at the database level.&lt;BR /&gt;&lt;BR /&gt;When rules are present in database, and we have a workflow to create parcels from CAD lines, we don't necessarily know all the rules that are in the database we are working in. We don't want any rules to interfere with our "creation" process until it's time to "save", then we want the rules to apply.&lt;BR /&gt;&lt;BR /&gt;If we could at the beginning of our workflow "disable" all attribute rules, then at the end of it, enable them back.&lt;/P&gt;&lt;P&gt;That would be great!&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 13:53:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-ideas/quick-way-to-enable-disable-attribute-rules-at/idi-p/1216920</guid>
      <dc:creator>PascalVezina</dc:creator>
      <dc:date>2022-09-28T13:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Quick way to Enable/Disable Attribute Rules at Database level</title>
      <link>https://community.esri.com/t5/attribute-rules-ideas/quick-way-to-enable-disable-attribute-rules-at/idc-p/1216938#M102</link>
      <description>&lt;P&gt;I agree - I had to create the following script to do that (currently does off but code for turning back on is also present.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#0-EnableDisableAttributeRules.py
#
# Rules set to "Off" will enable attribute rules. 
#
# Inputs: All feature classes in Geodatabase (rules off) 
#   Geodatabase path built from a couple different variables 
#   leftovers from ArcMap/ArcInfo days 
#
# Outputs: All feature class in Geodatabase with attribute rules either turned on or off
# 
# Dean - 11/2020

import os,arcpy,time,datetime,traceback,shutil


def DisableRules(FC,ruletypes):
    desc = arcpy.Describe(fc).attributeRules
    for rule in desc:
        for rtype in ruletypes:
            rtypeesri = "esriART" + rtype
            print (rtypeesri)
            if rule.isEnabled == True and rule.type == rtypeesri:
                print("Disabling " + rtype + " rule: {}".format(rule.name))
                arcpy.DisableAttributeRules_management(fc, rule.name)
            
def EnableRules(FC,ruletypes):
    desc = arcpy.Describe(fc).attributeRules
    for rule in desc:
         for rtype in ruletypes:
            rtypeesri = "esriART" + rtype
            #print (rtypeesri)
            if rule.isEnabled == False and rule.type == rtypeesri:
                print("Enabling " + rtype + " rule: {}".format(rule.name))
                arcpy.EnableAttributeRules_management(fc, rule.name)

#######################################
                
try:
    logfile = "D:\\GISLogs\\DisableAttributeRulesAllOff.txt"
    arcpy.Delete_management (logfile) 
    logfile = open(logfile, "w")   
    starttime =  datetime.datetime.now()
    logfile.write ('\n' + '\n' + "StartTime:" + str(starttime) + '\n' + '\n')
    print ("StartTime:" + str(starttime))
    
    Rules = "Off" 

    Tile = 'T7-4'
    print (Tile)

    Library = 'P:\\ORMAProFabric\\TaxmapPolkV302\\'
    OutDb = Library + Tile + "\\Fabric\\TownEd.gdb"

    FabricPath = OutDb    
    arcpy.env.workspace = FabricPath
        
                
    datasets = arcpy.ListDatasets(feature_type='feature')
    datasets = [''] + datasets if datasets is not None else []
    ruletypes = ["Constraint","Calculation","Validation"]
    #ruletypes = ["Calculation"]
    
    for ds in datasets:
        for fc in arcpy.ListFeatureClasses(feature_dataset=ds):
            print (fc) 
            path = os.path.join(arcpy.env.workspace, ds, fc)
            if Rules == "On":
                EnableRules(fc,ruletypes)
            else:
                DisableRules(fc,ruletypes)

except:
    badness = traceback.format_exc()
    print ('\n' + '\n' + "*** BADNESS ****" + '\n' + '\n')
    print (badness)
    
    logfile.write ('\n' + '\n' + "**** BADNESS *****" + '\n' + '\n')
    logfile.write (badness)
    
    logfile.close()
    &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 14:32:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-ideas/quick-way-to-enable-disable-attribute-rules-at/idc-p/1216938#M102</guid>
      <dc:creator>DeanAnderson2</dc:creator>
      <dc:date>2022-09-28T14:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Quick way to Enable/Disable Attribute Rules at Database level</title>
      <link>https://community.esri.com/t5/attribute-rules-ideas/quick-way-to-enable-disable-attribute-rules-at/idc-p/1216998#M103</link>
      <description>&lt;P&gt;Just to be sure - if this SDE it it is a SCHEMA change so you have other problems.&amp;nbsp; Changing a SCHEMA impacts everyone.&amp;nbsp; So... this works well in a geodatabase but not sure in a workflow how it would work for you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 16:15:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-ideas/quick-way-to-enable-disable-attribute-rules-at/idc-p/1216998#M103</guid>
      <dc:creator>DeanAnderson2</dc:creator>
      <dc:date>2022-09-28T16:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Quick way to Enable/Disable Attribute Rules at Database level</title>
      <link>https://community.esri.com/t5/attribute-rules-ideas/quick-way-to-enable-disable-attribute-rules-at/idc-p/1314756#M156</link>
      <description>&lt;P&gt;You are probably right in an SDE environment, this should be applied only to the current user, not all users.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 19:06:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-ideas/quick-way-to-enable-disable-attribute-rules-at/idc-p/1314756#M156</guid>
      <dc:creator>PascalVezina</dc:creator>
      <dc:date>2023-08-02T19:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Quick way to Enable/Disable Attribute Rules at Database level</title>
      <link>https://community.esri.com/t5/attribute-rules-ideas/quick-way-to-enable-disable-attribute-rules-at/idc-p/1387439#M215</link>
      <description>&lt;P&gt;There isn't an out of the box way to do it but you can script it with an options table as I show here&amp;nbsp;&lt;A href="https://community.esri.com/t5/attribute-rules-blog/how-to-toggle-constraint-and-calculation-attribute/ba-p/1387438" target="_blank"&gt;https://community.esri.com/t5/attribute-rules-blog/how-to-toggle-constraint-and-calculation-attribute/ba-p/1387438&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 15:35:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-ideas/quick-way-to-enable-disable-attribute-rules-at/idc-p/1387439#M215</guid>
      <dc:creator>HusseinNasser2</dc:creator>
      <dc:date>2024-02-27T15:35:41Z</dc:date>
    </item>
  </channel>
</rss>

