For reordering fields in the attribute table (GDB FC) there are lots of solutions, e.g.:
Reordering fields (permanently) in file geodatabase using ArcGIS Desktop?
How do I change the attribute field order in a feature class
To avoid overwriting the field names list in the python script each time I´d like to create a tool with Model Builder.
To integrate the script within the toolbox parameters need to be defined. For this I found the following thread (similar code to the previous link with some changes in the end of the script):
Formatting parameters for a field reordering tool
Parameters based on the 1th thread (by new_field_order parameter, multiple values allowed):
Parameter definition based on the 3ththread:
Although the input and output parameters were set correctly and the new_field_order variable was defined as a blank list I´m dealing with 2 problems when I open the script in the toolbox:
To solve this problem, I suggest I have to implement the script in the model builder. My idea was to use the “create a new FC tool” and define the output FC as a parameter. For the out_fc variable in the script properties, I can set derived as type but I don´t understand why I cannot select the created FC as a value by “Obtained from”.
I´m wondering what I´m doing wrong because the python script I used compared to the second thread is exactly the same but I cannot define the field names (maybe the script functions only for SHP but no for GDB FC?)
I also tried to use the Output FC (Create FC tool) for the in_fc but still I cannot see any field names.
I also tried to use the Output FC (Create FC tool) for the in_fc but still I cannot see any field names. Do you have any ideas how to set the parameters or modify the model so I can at least I can define the order of field names within the box:
In the advanced version I have created a simple model (and it functions well):
(or I can use the X-Ray for ArcCatalog add-in) but in the basic version the field order within the merge tool (Field Mapping) cannot be changed by up/down arrows).
Listing the field names and changing their order as strings in the arcpy console (if you have lots of field names) is pretty time-consuming.
Many thanks for your suggestions!