Skip To Content

QueryField

Summary

The QueryFieldobject exposes properties detailing a field returned by the queryJobs method.

Discussion

The QueryField object of a certain QueryResult row can be accessed by index or iterator.

Properties

PropertyExplanationData Type
name
(Read Only)

The field name returned from job query.

String
alias
(Read Only)

The field alias returned from job query.

String

Code sample

The following script runs a job query and accesses the query field.

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)