<?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: How to alter field size? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-alter-field/m-p/1226607#M8981</link>
    <description>&lt;P&gt;Yes, I have tried. It does not work on shapefile but works with gdb table. I have tried to change field name. alias name and length of TEXT field. There is some limitation with field type changing&lt;/P&gt;&lt;P&gt;Have you checked what you get from&amp;nbsp;oGeodatabase.GetPath().LocalPath ?&lt;/P&gt;</description>
    <pubDate>Fri, 28 Oct 2022 13:57:28 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2022-10-28T13:57:28Z</dc:date>
    <item>
      <title>How to alter field?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-alter-field/m-p/1226466#M8975</link>
      <description>&lt;P&gt;I try to alter a field size and alias using &lt;STRONG&gt;Geoprocessing Tool&lt;/STRONG&gt;. Even if there is no error, the field is not altered.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;List&amp;lt;object&amp;gt; oParams = new List&amp;lt;object&amp;gt;();

oParams.Add(oGeodatabase.GetPath().AbsolutePath);
oParams.Add(sTableName);
oParams.Add(sFieldName);
oParams.Add(sNewFieldName);
oParams.Add(sNewAlias);
oParams.Add("TEXT");
oParams.Add(60); // The actual field size is 50

var parameters = Geoprocessing.MakeValueArray(oParams);
var gpResult = Geoprocessing.ExecuteToolAsync("management.AlterField", parameters, null, CancelableProgressor.None, GPExecuteToolFlags.None);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Python&lt;/STRONG&gt; script can be find here :&lt;BR /&gt;&lt;A href="https://pro.arcgis.com/fr/pro-app/2.9/tool-reference/data-management/alter-field-properties.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/fr/pro-app/2.9/tool-reference/data-management/alter-field-properties.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the same syntax for&amp;nbsp;&lt;STRONG&gt;AddCodedValueToDomain&lt;/STRONG&gt; and it works, so I know that my geodatabase parameter is correct.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 13:50:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-alter-field/m-p/1226466#M8975</guid>
      <dc:creator>RejeanLabbe</dc:creator>
      <dc:date>2022-10-28T13:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to alter field size?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-alter-field/m-p/1226498#M8978</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You have wrong parameters list. TableName and geodatabase path must be combined together:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var parameters = Geoprocessing.MakeValueArray(Path.Combine(oGeodatabase.GetPath().AbsolutePath, sTableName), sFieldName, sNewFieldName, sNewAlias, "TEXT");
var gpResult = Geoprocessing.ExecuteToolAsync("management.AlterField", parameters, null, CancelableProgressor.None, GPExecuteToolFlags.None);&lt;/LI-CODE&gt;&lt;P&gt;You can change field type if&amp;nbsp;&lt;SPAN&gt;the input table is empty (does not contain records)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 05:27:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-alter-field/m-p/1226498#M8978</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2022-10-28T05:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to alter field size?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-alter-field/m-p/1226596#M8980</link>
      <description>&lt;P&gt;Thank Gintautas. Unfortunately, this doesn't work. Have you tried it?&lt;/P&gt;&lt;P&gt;I tried multiple combinations but nothing works :&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Path.Combine(oGeodatabase.GetPath().LocalPath, sTableName)
// or
oGeodatabase.GetPath().AbsolutePath + "/" + sTableName&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to change only the alias, but the change is not applied.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 13:41:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-alter-field/m-p/1226596#M8980</guid>
      <dc:creator>RejeanLabbe</dc:creator>
      <dc:date>2022-10-28T13:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to alter field size?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-alter-field/m-p/1226607#M8981</link>
      <description>&lt;P&gt;Yes, I have tried. It does not work on shapefile but works with gdb table. I have tried to change field name. alias name and length of TEXT field. There is some limitation with field type changing&lt;/P&gt;&lt;P&gt;Have you checked what you get from&amp;nbsp;oGeodatabase.GetPath().LocalPath ?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 13:57:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-alter-field/m-p/1226607#M8981</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2022-10-28T13:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to alter field size?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-alter-field/m-p/1226619#M8982</link>
      <description>&lt;P&gt;Thanks Gintautas.&lt;/P&gt;&lt;P&gt;Combining the geodatabase path and the table name did the trick.&lt;/P&gt;&lt;P&gt;However, I had another issue with my parameter list.&lt;/P&gt;&lt;P&gt;This is my final working code :&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;List&amp;lt;string&amp;gt; oParams = new List&amp;lt;string&amp;gt;();

oParams.Add(Path.Combine(oGeodatabase.GetPath().AbsolutePath, sTableName));
oParams.Add(sFieldName);
oParams.Add(sNewFieldName);
oParams.Add(sNewAlias);
oParams.Add(sFieldType);

if (sFieldType == "TEXT" || sFieldType == "BLOB") {
	oParams.Add(sSize); // The field size must be the same or greater
}

var gpResult = Geoprocessing.ExecuteToolAsync("management.AlterField", oParams, null, CancelableProgressor.None, GPExecuteToolFlags.None);&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 28 Oct 2022 14:49:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-alter-field/m-p/1226619#M8982</guid>
      <dc:creator>RejeanLabbe</dc:creator>
      <dc:date>2022-10-28T14:49:47Z</dc:date>
    </item>
  </channel>
</rss>

