Set your script properties to mimic your variable name, and set to string. The first item is to update your python code line 58 to be a blank list:Ĭreate a new toolbox => Right click => add => script. Instead of posting screenshots of my field names, I included your field mappings below. I downloaded your script and set it up on some of my sample test data set. Reorder_fields(intable, outtable, new_field_order, add_missing=True) Outtable = r"Y:\Huggins_D\2016\Tool\Export_Output_TEST.shp" ![]() Intable = r"Y:\Huggins_D\2016\Tool\Export_Output.shp" # use merge with single input just to use new field_mappingsĪrcpy.Merge_management(table, out_table, new_mapping) Raise Exception("Field: ".format(field_name, table)) If field_name not in existing_field_names: # required fields (OBJECTID, etc) will not be in existing mappingsįield_map = existing_mapping.fieldMappings Mapping_index = existing_mapping.findFieldMapIndex(field_name) :add_missing: add missing fields to end if True (leave out if False)Įxisting_fields = arcpy.ListFields(table)Įxisting_field_names = :field_order: order of fields (objectid, shape not necessary) :out_table: output table (fc, table, layer, etc) :table: input table (fc, table, layer, etc) Reorders fields in input featureclass/table How do I set this parameter to read a user-defined order for the fields in the same way I hardcoded it? Also, is there any way to reorder the fields in a temporary attribute table in ArcMap, write code to read the temporary order, and use that order to export the new shapefile (in order to avoid having to type out the desired order)?ĭef reorder_fields(table, out_table, field_order, add_missing=True): I tried setting the parameter as a string, but am getting the exception in line 38 raised. In making a script tool, I'm not sure how to set the parameter to define new_field_order. ) with code that used the Merge tool to accomplish this, and when I hardcoded it for a test shapefile, it worked well (despite having to list out the fields in the order desired in a string - line 59). I found a previous discussion ( arctoolbox - How to re-order fields permanently using ArcGIS Make Query Table tool? - Geographic Inf. It's so much more practical to type or paste longwinded URLs like from my home desktop than to laboriously tip-tip-tap it on the phone or iPad.I'm trying to make a script tool that reorders the fields in an attribute table and exports a new shapefile with the updated field order. Once again Type2Phone came to the rescue. I was trying to set up a SOCKS proxy system and had to keep typing addresses for various configurations. Type2Phone makes that a practical exercise in testing instead of torment. In a normal debug session, you may sign out and sign in with various credentials dozens of times. ![]() You usually work with many different accounts, testing to see how access works for new users, for those with a good history of application use or for those who have unlocked certain achievements. While this may not sound like a big thing for many iOS users - after all, the onboard keyboards and new dictation features streamline text entry - it is a huge deal for devs and IT coordinators who have to keep typing similar things into apps and settings, over and over again.įor example, take Game Center development. With it, you type to your iOS device using your normal desktop keyboard. ![]() ![]() It emulates a Bluetooth keyboard from your Mac. Type2Phone ( US$4.99) is one of the most practical tools in my development toolbox.
0 Comments
Leave a Reply. |