Automation Center Documentation

Using Variables in a Workflow

From OpsWise Documentation Wiki

image:pdficon_small.gif Open as PDF

For tasks executing within a workflow, the order of precedence for resolving user-defined variables differs. As the following exercise demonstrates, the variable definition in the task takes precedence, then the system looks within the workflow or parent workflow(s), with the global variable coming last.

Prerequisite: You need a working database connection to do this exercise.

  1. Create a SQL task called SQL With Variable with the following SQL command.
  2. CREATE TABLE ${tutorial}${_date("yyyyMMdd",5)} (name varchar(128), value varchar(128));
    
  3. Within the task, define a variable called tutorial, with a value of task.
  4. Submit the SQL task.
  5. Create a new workflow called Variable Workflow.
  6. Add the SQL With Variable task and save the workflow.
  7. Launch the workflow and open the SQL With Variable task instance on the Activity screen. Note that the SQL command resembles the following, with the value from the task variable.
  8. CREATE TABLE task20090913 (name varchar(128), value varchar(128));
    
  9. Open the task and delete the task variable.
  10. Go back to Variable Workflow and add the following variable:
  11. tutorial/workflow
    
  12. Open the task instance. The SQL command used the variable from the workflow because the task no longer had a variable.
  13. CREATE TABLE workflow20090913 (name varchar(128), value varchar(128));
    

image:sb15-1.gif


Return to First Look menu.

For additional information, see:

Personal tools