<?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: Altering field length if field = string in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/altering-field-length-if-field-string/m-p/331591#M2115</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi dan,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for having a look.&lt;/P&gt;&lt;P&gt;I can confirm I was performing this on empty fc's. I want to avoid creating new fc's as there are alot of domains applied to many fc's in the dataset and it would be a hassle apllying them again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Jun 2017 00:18:20 GMT</pubDate>
    <dc:creator>DanScott</dc:creator>
    <dc:date>2017-06-02T00:18:20Z</dc:date>
    <item>
      <title>Altering field length if field = string</title>
      <link>https://community.esri.com/t5/developers-questions/altering-field-length-if-field-string/m-p/331589#M2113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Im trying to automate a couple of processing at work but Ive hit a brick wall in trying to change the length of a field in a FC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to get the script to iterate over all of the FC's in a dataset and all of the fields of that FC to find the string/text fields but I cant seem to ge the alterfield_management correct and its driving me crazy.&lt;/P&gt;&lt;P&gt;I was doing this on empty FCs andI have seen solutions that create a new FC with the same fields but extended length but this isn't a option because I have many domains attached to the many fcs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;arcpy

&lt;SPAN style="color: #808080;"&gt;#Set workspace
&lt;/SPAN&gt;arcpy.env.workspace = &lt;SPAN style="color: #008000; font-weight: bold;"&gt;r'C:\Users\daniel\AppData\Roaming\ESRI\Desktop10.4\ArcCatalog\gdb'
&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;#Loop through feature classes looking for a field that is a string'
&lt;/SPAN&gt;fcList = arcpy.ListFeatureClasses() &lt;SPAN style="color: #808080;"&gt;#get a list of feature classes
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;fc &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;fcList:&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;#loop through feature classes
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;fieldList = arcpy.ListFields(fc)&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;#get a list of fields for each feature class
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;field &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;fieldList: &lt;SPAN style="color: #808080;"&gt;#loop through each field
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;field.type == &lt;SPAN style="color: #008000; font-weight: bold;"&gt;'Text'&lt;/SPAN&gt;:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AlterField_management(fc, field.name, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;''&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;''&lt;/SPAN&gt;,&lt;SPAN style="color: #008000; font-weight: bold;"&gt;''&lt;/SPAN&gt;,&lt;SPAN style="color: #008000; font-weight: bold;"&gt;'2000'&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;I only want to edit the field length and not any other feature. Any help/feedback if youve had success would be welcome, thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:41:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/altering-field-length-if-field-string/m-p/331589#M2113</guid>
      <dc:creator>DanScott</dc:creator>
      <dc:date>2021-12-11T15:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Altering field length if field = string</title>
      <link>https://community.esri.com/t5/developers-questions/altering-field-length-if-field-string/m-p/331590#M2114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect you aren't working with empty (aka new) tables &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/alter-field-properties.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;from the help&lt;/A&gt; &amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;The new length of the field. This sets the maximum number of allowable characters for
 each record of the field. This option is only applicable on fields of type TEXT or BLOB.
 Only applicable if table is empty.&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:41:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/altering-field-length-if-field-string/m-p/331590#M2114</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T15:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Altering field length if field = string</title>
      <link>https://community.esri.com/t5/developers-questions/altering-field-length-if-field-string/m-p/331591#M2115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi dan,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for having a look.&lt;/P&gt;&lt;P&gt;I can confirm I was performing this on empty fc's. I want to avoid creating new fc's as there are alot of domains applied to many fc's in the dataset and it would be a hassle apllying them again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jun 2017 00:18:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/altering-field-length-if-field-string/m-p/331591#M2115</guid>
      <dc:creator>DanScott</dc:creator>
      <dc:date>2017-06-02T00:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Altering field length if field = string</title>
      <link>https://community.esri.com/t5/developers-questions/altering-field-length-if-field-string/m-p/331592#M2116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for taking a look! I can confirm these fc's are empty as they are used as templates. I will try testing with another dataset to see if this could be the problem though. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wanted to avoid creating new FC's because the current ones have many domains attached (possible issue?).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jun 2017 00:22:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/altering-field-length-if-field-string/m-p/331592#M2116</guid>
      <dc:creator>DanScott</dc:creator>
      <dc:date>2017-06-02T00:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Altering field length if field = string</title>
      <link>https://community.esri.com/t5/developers-questions/altering-field-length-if-field-string/m-p/331593#M2117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for taking a look! I can confirm these fc's are empty as they are used as templates. I will try testing with another dataset to see if this could be the problem though. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wanted to avoid creating new FC's because the current ones have many domains attached (possible issue?).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jun 2017 00:31:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/altering-field-length-if-field-string/m-p/331593#M2117</guid>
      <dc:creator>DanScott</dc:creator>
      <dc:date>2017-06-02T00:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Altering field length if field = string</title>
      <link>https://community.esri.com/t5/developers-questions/altering-field-length-if-field-string/m-p/331594#M2118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for taking a look.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was doing this on empty FCs so this should have been the problem. But I will give the script a run on a completely new table.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have seen solutions that create a new FC with the same fields but extended length but this isn't a option because I have many domains attached to the many fcs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jun 2017 00:45:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/altering-field-length-if-field-string/m-p/331594#M2118</guid>
      <dc:creator>DanScott</dc:creator>
      <dc:date>2017-06-02T00:45:55Z</dc:date>
    </item>
  </channel>
</rss>

