Hi all
I create an arctoolbox using field mapping in the code. I was able to add my table to the field mapping object. I remember that in the merge tool, I can change the field names, formatting, etc. from the field mapping zone. I believe that there is code behind that. I tried but unfortunately I was not able. When I change for example my field name and click in other place, my changes are not kept and i got only my original field names.
I know that perhaps I have to use the FiledMap object. My problem is that I don't know how to link the manual changes I make in field mappings zone and a code that can take those changes and show them in the field mapping zone.
In reality, I don't know how to program this link?
Any help
Thanks
Message was edited by: Dan Patterson I shortened your title...there is no need to repeat the title multiple times to try and draw attention to it. I also added some tags so it won't languish in the questions section.
Please see the attached file
What have you tried so far?
See if this link will help FieldMappings—Help | ArcGIS for Desktop
Hi
Thanks. I was looking in the FieldMapping help.
My problem is how from my manual changes in FieldMapping Zone, I can keep the changes. i mean, after right clicking on a field, make changes and see that those changes are kept (as what we can do with merge tool)
Here what I did in validation :
def updateParameters(self):
if self.params[1].altered:
self.params[3].value = None
tfms = arcpy.FieldMappings()
tfms.addTable(self.params[1].value)
self.params[3].value = tfms.exportToString()
return
Thanks
Did you look at example 2 in the link i gave you? It seems to do what you are asking.
Please My issue reside in :
Said, are you trying to change the OBJECTID field itself? That is an internal/reserved field and I don't think you can change it. I would copy the value of the OBJECTID field to a new field and manipulate that. My opologies if that is not what you are doing, but the graphic shows it.
Whatever change I made with Output Field Properties (right click) on whatever non reserved field, It does not work. All my changes disappear
Thanks
I want just do what is possible in Merge tool. In the FieldMapping Zone, We can rename fields, change their format length, type. And after those changes are preserved in the interface before running the tool.
Any Help please
Thanks
Hi
When I right click on a field in the Field Mapping zone, I notice that there is a difference and perhaps it is the source of my problem. please take a look to the following: