python - How to use the List field function for a toolbox script? -


I am trying to write a simple script for a toolbox, such as Addfield_datamanagement toolbox script With a specialty table, a feature field adds a new field or sizefile to a table so far so good. # Import system modules import arppy #Workspace arcpy.env.workspace = "C: \\ user \\ xxx.gdb" # Feature class inputFFC = arcpy.GetParameterAsText Set (0) # Get list of field names in input string = ARPP.GetParameterSTtext (1) InputString = ARPP. ValidationFilename (inputstring, archp.एन.एन.व्ही. वर्कस्पेस) fieldlist = inputstring.spitit (";") fieldtype = archp.gateParamrayArrayText (2)

for field then it seems to work is; List in the field: arcpy.AddField_management (inputFC, fieldName, fieldType) arcpy.AddMessage ("Field Generated:" + fieldName) arcpy.AddMessage ("Script executed") field name is already built and prints the existing name! Not sure about the syntax of lin (Archaic ListField, Fill?) == 1: #: ListFields and not sure how to integrate it is not sure whether the input FC is correct? Arcpy.AddMessage ("Field already exists" field name)

This is in the above code! So, any help is welcome and appreciated!

list field field list Inam Each object is associated with it.

The structure looks like this:

  field_list = [field object1: field.name, field.type, etc. ..; field object2: field.name, field.type, etc ...;]   

You might want to determine that this variable is in fieldList To define any name, you want to use the .name attribute of each field object.

First, create a list of field names: < / p>

  current movie TS = [] Fields in Arcpy.ListFields (Input FC) for # AMP list: Repeat fields.append (field.name) on # existing fields # Add list name attribute names to each field   

Next, users of the existing field with the list of compare list fields, who want to add:

  duplicate field = set (current field) & amp; Set (Field List) If Lane (Duplicate Field) == 0: Continue with adding other areas: arcpy.AddMessage ('field already exists:' + duplicate field)    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -