Using Workflow Parameters and Variables to Write to a Dynamic Target File

Using Workflow Parameters and Variables to Write to a Dynamic Target File

Step 5. Add an Assignment Task to Assign a Value to the Variable

Step 5. Add an Assignment Task to Assign a Value to the Variable

An Assignment task assigns a value to a user-defined workflow variable. Add an Assignment task before the Mapping task in the workflow. Use an expression in the Assignment task to assign the value of the department name parameter and the current date to the workflow variable.
  1. Right-click the workflow editor and select
    Add Workflow Object
    .
  2. Select
    Assignment Task
    and click
    OK
    .
    The Assignment task appears in the editor.
  3. In the
    Properties
    view for the Assignment task, click the
    General
    tab.
  4. Rename the Assignment task.
    For example, name the Assignment task asgn_TargetFileName.
  5. Select the Assignment task and move the task between the Start event and the Mapping task.
  6. Add a sequence flow to connect the Start event to the Assignment task.
  7. Add another sequence flow to connect the Assignment task to the Mapping task.
    The following figure shows the connected events and tasks in the workflow:
  8. In the
    Properties
    view for the Assignment task, click the
    Assignment
    tab.
  9. In the
    User-defined Variable
    column, select the variable that you created for the target file name.
    The following figure shows the selected dynamicTargetFileName variable:
  10. In the Expression column, click the
    Open
    button ( "" 
				) to open the
    Assignment Expression Editor
    .
  11. Use the point-and-click method in the
    Assignment Expression Editor
    to enter the expression.
    1. In the
      Inputs
      tab, expand the
      Parameter
      folder.
    2. Double-click the parameter that you created for the department name.
      The Developer tool adds the workflow parameter using the required syntax for expressions.
    3. Use the concatenation operator (||), the SUBSTR function, the TO_CHAR function, and the built-in variable sysdate to add the current date to the workflow parameter value.
      For example, the following expression adds the current month, day, and year to the workflow parameter value:
      $par:DepartmentName||SUBSTR(TO_CHAR(sysdate),1,2) || '_' || SUBSTR(TO_CHAR(sysdate),4,2) || '_' || SUBSTR(TO_CHAR(sysdate),7,4)||'.out'
      The following figure shows the completed expression in the Assignment Expression Editor:
    4. Click
      Validate
      to validate the expression.
    5. Click
      OK
      to close the
      Expression Editor
      .
    The Developer tool displays the workflow variable and the expression assigned to the variable.

0 COMMENTS

We’d like to hear from you!