描述
QueryField 对象显示了对 queryJobs 方法返回的字段进行详细描述的属性。
讨论
通过索引或迭代器可以访问指定 QueryResult 行的 QueryField 对象。
属性
属性 | 说明 | 数据类型 |
name (只读) | 从作业查询返回的字段名称。 | String |
alias (只读) | 从作业查询返回的字段别名。 | String |
代码示例
以下脚本运行作业查询并访问查询字段。
import arcpy
#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')
#Run a query for jobs being assigned to current user. The query results are sorted by job name.
result = conn.queryJobs("JOB_NAME,ASSIGNED_TO","JTX_JOBS","Job Name,Assigned To", "ASSIGNED_TO = '[SYS:CUR_LOGIN]'", "JOB_NAME")
#To get total number of records being returned which are assigned to current user.
print("There are %s jobs assigned to me" % str(len(result.rows)))
# Access first field by index
print ("The first field is named %s" % result.fields[0].name)
# Access each field by iterator
for f in result.fields:
print("Field is %s" % f.name)