摘要
WorkflowStep 对象可用于访问作业中包含的步骤的属性 Workflow。
说明
WorkflowStep 支持通过工作流描述步骤并导航。
属性
属性 | 说明 | 数据类型 |
ID (只读) | WorkflowStep 的 ID。 | Integer |
name (只读) | WorkflowStep 的名称。 | String |
nextSteps (只读) | 遵循工作流中此步骤的 WorkflowStep ID 列表。 | Integer |
代码示例
以下脚本将在作业的工作流中搜索与特定步骤名称对应的步骤 ID 以及与特定步骤 ID 对应的步骤名称。
import arcpy
#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')
#Access a Job
job = conn.getJob(99999)
#Access a the job's workflow
workflow = job.getWorkflow()
#Access the first step in the workflow
step = workflow.steps[0]
#Print the name of the first step
print (step.name)
#Find the step IDs of all the steps named "Clean Up" in the workflow
stepIDs = [x.ID for x in workflow.steps if x.name == "Clean Up"]
#Print the step IDs of the steps named "Clean Up"
print (stepIDs)
#Find the step name of the step with the ID of 123
stepName = [y.name for y in workflow.steps if y.ID == 123]
#Print the name of the step with an ID of 123
print ("The step name for ID 123 is " + stepName[0])