POST
|
Could someone show me how to make something like this in a python toolbox as well as explain to me what is going on here? I know that the user can select either a table or a feature class and this dialog box will create a list of the fields with check boxes. One question I have is when the user checks the fields and clicks OK, does it make a list of the checked fields or does it do something else? The code below is a close as I've gotten to the above image, even though I know all it does it let you select a single field from the list of fields. Any help would be much appreciated. Thanks! # Third parameter - User will select the parcel ID field
parcelID = arcpy.Parameter(
# Name that shows inside the tools dialog
displayName = "Select the Paracel ID field",
# This variable puts the displayName over the input
name = "parcelID",
# Accepts a field as input
datatype = "Field",
# Have to enter somthing before the tool can run
parameterType = "Required",
# It's an input to the tool
direction = "Input")
parcelID.parameterDependencies = [existingData.name]
... View more
12-18-2014
01:21 PM
|
0
|
1
|
1884
|
POST
|
I just used: for i in range(len(parcelFieldList)):
if parcelFieldList.editable:
parcelFieldNames.append(str(parcelFieldList.name))
... View more
12-10-2014
09:19 AM
|
0
|
1
|
716
|
POST
|
Thanks for your quick reply! From your post, I realized that I could use the editable method to check to see if a field can be deleted or not!
... View more
12-10-2014
09:11 AM
|
0
|
1
|
716
|
POST
|
Is there a way I can create a list of only the deletable fields in a feature class (and by deletable I mean fields other than OBJECTID, Shape, etc . I tried using arcpy.ListFields(), but it list all of the feilds.
... View more
12-10-2014
08:22 AM
|
1
|
6
|
2298
|
POST
|
I did not use the descriptions from the metadata as field names, I used them as aliases. I'm guessing that replacing field names have some limitations on the length, where alias don't . I've attached a picture of what a portion of my table looks like.
... View more
12-05-2014
09:11 AM
|
1
|
1
|
163
|
POST
|
Upon further inspection of my census block group data (which includes: a feature class (polygon) and a metadata table) I found that the feature class had an additional field, OBJECTID_1, that was not included in the metadata table. After I deleted that field from the feature class, the program ran just fine except for an out or range error, which i'm assuming has to do with the use of len(fieldList) in the for loop. I really appreciate the quick responses.
... View more
12-03-2014
12:31 PM
|
0
|
6
|
1115
|
POST
|
I'm not sure about the empty string, but when I ran it without one it crashed immediately. Perhaps you would know the proper way to skip over an optional field? The program did go about halfway through the renaming of aliases process and then stopped at this string: SEX BY EDUCATIONAL ATTAINMENT FOR THE POPULATION 25 YEARS AND OVER - Universe: Population 25 years and over - Total: Male: Doctorate degree -- (Estimate). This is interesting because the ones proceeding it are very similar. Any other suggestions for this problem would be great and thanks for your help!
... View more
12-03-2014
10:07 AM
|
0
|
0
|
1115
|
POST
|
I am trying to write a script that that changes the aliases of a table's fields, but when I ran it I got this code error: ExecuteError: ERROR 001601: Failed to alter field alias. Failed to execute (AlterField). This makes no sense to me and I would love any input as to why this happened. Also, here is my code that generated this error: # Import geoprocessing
import arcpy
# Set workspace
arcpy.env.workspace = r'U:\newberry\new.gdb'
# Creates a list of fields from the Metadata_2010 table
fieldListTable = arcpy.ListFields("METADATA_2010")
# Creates a cursor - a data access object
rows = arcpy.SearchCursor("METADATA_2010")
# Creates an empty table to store row values
fullNames = []
# For loop thats iterates through the rows in
# the Full_Name field of the Metadata_2010 table
for row in rows:
# Adds the row value to the fullNames list
fullNames.append(row.getValue(fieldListTable[2].name))
# Creates a sliced list of fields from the census block group
# polygon feature class
fieldList = arcpy.ListFields("please")[2:630]
# For loop thats changes the existing alias name in the table
# to the name in the fullNames list
for i in range(len(fieldList)):
arcpy.AlterField_management('please', str(fieldList.name),'',str(fullNames))
... View more
12-02-2014
02:34 PM
|
0
|
11
|
3232
|
Title | Kudos | Posted |
---|---|---|
1 | 12-05-2014 09:11 AM | |
1 | 12-10-2014 08:22 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|