<?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 New arcpy user needing help with changing attribute fields, and values in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/new-arcpy-user-needing-help-with-changing/m-p/525122#M41151</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So heres my problem: I want to create a tool that will take 2 point shapefiles, Change the title of some of their attribute fields, change the value of attributes from an integer to a string (which I think I can do with a for loop with nested if/else statements), then append a third shapefile with the now modified shapefiles.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The way I'm thinking of doing this is to run feature class to feature class conversions on my 2 original shapefiles, saving the outputs in a scratch geodatabase.&amp;nbsp; I'm having trouble thinking up the code to make this happen.&amp;nbsp; Do I change the attribute field names in the conversion?&amp;nbsp; Is there another function or technique that would be better to do it afterword? How do I change the field type from a int to a string using python?&amp;nbsp; Any help would be greatly appreciated.&amp;nbsp; Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Jan 2014 13:25:24 GMT</pubDate>
    <dc:creator>ZacharyHassler</dc:creator>
    <dc:date>2014-01-17T13:25:24Z</dc:date>
    <item>
      <title>New arcpy user needing help with changing attribute fields, and values</title>
      <link>https://community.esri.com/t5/python-questions/new-arcpy-user-needing-help-with-changing/m-p/525122#M41151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So heres my problem: I want to create a tool that will take 2 point shapefiles, Change the title of some of their attribute fields, change the value of attributes from an integer to a string (which I think I can do with a for loop with nested if/else statements), then append a third shapefile with the now modified shapefiles.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The way I'm thinking of doing this is to run feature class to feature class conversions on my 2 original shapefiles, saving the outputs in a scratch geodatabase.&amp;nbsp; I'm having trouble thinking up the code to make this happen.&amp;nbsp; Do I change the attribute field names in the conversion?&amp;nbsp; Is there another function or technique that would be better to do it afterword? How do I change the field type from a int to a string using python?&amp;nbsp; Any help would be greatly appreciated.&amp;nbsp; Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jan 2014 13:25:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/new-arcpy-user-needing-help-with-changing/m-p/525122#M41151</guid>
      <dc:creator>ZacharyHassler</dc:creator>
      <dc:date>2014-01-17T13:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: New arcpy user needing help with changing attribute fields, and values</title>
      <link>https://community.esri.com/t5/python-questions/new-arcpy-user-needing-help-with-changing/m-p/525123#M41152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can change the field names using the Feature Class to Feature Class function.&amp;nbsp; Or, if you are using 10.2.1, you can use the new &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000198000000"&gt;Alter Field&lt;/A&gt;&lt;SPAN&gt; function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To change the field type, you would need to create a new field with the new type and then calculate the values from the previous field to the new one.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jan 2014 14:07:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/new-arcpy-user-needing-help-with-changing/m-p/525123#M41152</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2014-01-17T14:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: New arcpy user needing help with changing attribute fields, and values</title>
      <link>https://community.esri.com/t5/python-questions/new-arcpy-user-needing-help-with-changing/m-p/525124#M41153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there, I think you're on the right track with the scratch geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Without 10.2, you can't change the name of an existing field, so you'll have to create new fields.&amp;nbsp; I would recommend these steps:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. copy features to scratch gdb (good because you won't be editing your original data)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. add new fields with new names and data types&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. to transfer the values from the old fields to the new, you can either use field calculate and cast the integer as a string, or you could run through the rows with cursors.&amp;nbsp; I think that if you are just going from integers to strings, field calculate should be ok (expression would be: str(!Old_Field!)).&amp;nbsp; Though, if you have null values, they will likely end up as "None".&amp;nbsp; Use cursors for more fine-grained control if you end up with special problem rows...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. drop the old fields (this is why it's good not to alter the original data)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5. append! (merge?)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could set this all up in model builder without too much trouble...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course, the problem with adding new fields is that you will not be able to retain the order of the original fields; the new ones will be on the end.&amp;nbsp; If this is a big problem, you may just want to do it manually using ArcGIS Diagrammer: &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/gallery/file/arcobjects-net-api/details?entryID=F12ADF8F-1422-2418-34B2-C276C6BCCF98"&gt;http://resources.arcgis.com/gallery/file/arcobjects-net-api/details?entryID=F12ADF8F-1422-2418-34B2-C276C6BCCF98&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jan 2014 14:11:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/new-arcpy-user-needing-help-with-changing/m-p/525124#M41153</guid>
      <dc:creator>AdamCox1</dc:creator>
      <dc:date>2014-01-17T14:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: New arcpy user needing help with changing attribute fields, and values</title>
      <link>https://community.esri.com/t5/python-questions/new-arcpy-user-needing-help-with-changing/m-p/525125#M41154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for your help Adam and JSkinn&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm still having trouble with my for loop with an if/else nested in it.&amp;nbsp; How do I reference a field in a feature class (shapefile), then append another field based on the if/else condition of the first referenced field for each iteration in the For loop going through the shapefiles features?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for any help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jan 2014 17:04:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/new-arcpy-user-needing-help-with-changing/m-p/525125#M41154</guid>
      <dc:creator>ZacharyHassler</dc:creator>
      <dc:date>2014-01-18T17:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: New arcpy user needing help with changing attribute fields, and values</title>
      <link>https://community.esri.com/t5/python-questions/new-arcpy-user-needing-help-with-changing/m-p/525126#M41155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I'm not exactly clear on what you're trying to do.&amp;nbsp; My best guess is that you are using one field in shapefile A to decide whether or not to add information from shapefile B to a different field in shapefile A.&amp;nbsp; If this is so, some more details/code would be very helpful in figuring this out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Field calculator may also work for this, because you could build a function into the calculation...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2014 13:53:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/new-arcpy-user-needing-help-with-changing/m-p/525126#M41155</guid>
      <dc:creator>AdamCox1</dc:creator>
      <dc:date>2014-01-20T13:53:58Z</dc:date>
    </item>
  </channel>
</rss>

