TransWikia.com

ModelBuilder - Iterate through tabels to join and export and keep original field names

Geographic Information Systems Asked by Morgan Atkins on October 5, 2021

I am trying to iterate through an excel with over 200 sheets and join each to a ZIP code layer. I then need to symbolize each of those the three different ways and save that to a layer file. In order to do that, I need the model to keep the original field names so the symbology can be done for all. Here is what my model looks like enter image description here

I have tried multiple routes to keep the field names. Utilizing the field info variable from Make Feature Layer, I can have the fields from the layer I am joining to (ZIP 2014) keep their original names, but the fields from the table still use the “Sheet__fieldname” convention and the fields from the table are what I have to base the symbolization on. I have unchecked maintain fully qualified field names for the Model properties as well as for the individual tools, and that doesn’t work.

My only workaround has been to export everything in the model as is, then create another model and use feature class to feature class to change the field names. I truly believe there has to be some way to get all this done in one swoop.

I am using ArcMap 10.2.2

4 Answers

Just an idea but if your output was a GeoDatabase Featureclass rather than a Shapefile you could use the Alter Field tool to rename it back as part of the work flow of the model?

Answered by Hornbydd on October 5, 2021

You should be able to use this option: http://resources.arcgis.com/en/help/main/10.1/index.html#//001w00000008000000

I am sure you can get there with field mappings if that doesn't work, but it would likely be a lot more lines of code than what youd expect.

https://geonet.esri.com/thread/30539

Answered by Mike on October 5, 2021

i am not sure if you got this answered . i am not very good with model builder , but your basis of your problem seemed similar to the one i had

when i was making layers for each unique value within a feild. I was using the value for the deinfation query and the name. But i ran into problems as the value could be john/ street. So when it was used in the defination query it would work , but when i tried to use it for the file name it would not save becuase of the / character. The solution was basically to have two seperate list that i was working with . One that would be the original content and would be used within the defination and one that would be used within the.

Is there was maybe you could build a list of your original field names in model builder That can be made into a dictionary . i am not sure if this is possible in model builder. But if it is

if you had the following feilds , Feild_A , Feild_B , Feild_c , Field_D.

you could make a list that would give you an sheet_feild_A , sheet_feild_B,sheet_feild_C,sheet_feild_D.

Then maybe you could combine your two lists into a dictionary where the Key is original field name and your value is your new feild name. Feild_A = sheet_feild_A

Answered by Jack Walker on October 5, 2021

I finally got it to work by making "Maintain fully qualified names" a variable from the environment. I did it for both the make feature layer and copy features just in case. I also made another variable for field info, but I'm not sure if that had anything to do with it working. It's really frustrating that changing the environment settings alone doesn't work. I swear before that just altering the environment fields setting worked, but maybe I didn't recreate exactly which settings I changed. Either way, creating a variable for it worked! I was also able to have layers created correctly for all the feature classes.

enter image description here

Answered by Morgan Atkins on October 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP