Creating Context Variable
You can create multiple context variables in a process flow using the PutContextVar action. Once they are created, you can use these context variables in the context of the process context as and when required.
Steps to create a Context Variable
Click hierarchy structure in the Repository View panel. Expand the Action list and select the Put-Context-Var action. Drag it to the Graph Canvas area. The Put-Context-Var action is displayed in the Graph Canvas.
Â
Right-click Put-Context-Var action and select View Properties. The properties of the Put-Context-Var action are displayed in the Properties Panel in the Bottom Pane (see Figure 99).
Â
- Click the Edit button. The Edit Context Variables screen is displayed. This screen displays a list of existing context variables and the Add Variable ( ), Edit Variable ( ) and Delete Variable ( ) buttons.
Â
The Edit Variable and Delete Variable buttons appear as disabled if no context variables have been created or no existing context variables have been selected.
Click Add Variable ( ) button to create a new context variable.
The Context Variable Information screen is displayed.
Select the name of the activity for which you want create the context variable, from the dropdown list Activity Name. This dropdown lists all the activities that are currently present on the Graph Canvas. Once you select the activity, all the attributes of the selected activity, are listed in the Variable Name dropdown list.
If the Activity Name field is left blank, then a new context variable is declared.
Select the attribute for which you want to create the context variable, from the dropdown list Variable Name. For example, you can select the File Path field in case of a File Source or File Target activity.
If the Activity Name field is blank, then the current context variables will be listed in the Variable Name dropdown list.
Enter the value that you want to set for the attribute/context variable, in the Variable Value field.
You can even append the current date or time stamp with the name of the file in the Variable Value field. To do this, click in the Variable Value field, and press <CTRL> + <Space Bar>. A list of the date and time format is displayed. Selecting a format from this list, displays it in the Variable Value field. Alternately, you can enter the required file path with the file name as in the example:
C:\target\File_target%%yyyy-MM-dd%%.txt
Â
The Variable Value field does not support '&' and '<' symbols.Click Done.This adds the context variable and takes the control back to the Edit Context Variables screen, where the new context variable is added to the list of existing context variables.
You can add multiple context variables (up to a maximum of 100) for the process flow.
Click Done on the Edit Context Variables screen to add all the displayed context variables to the context of the process flow.
Similarly, you can edit a context variable, by selecting it from the list of existing context variables on the Edit Context Variables screen. This selection will enable the Edit Variable button. Clicking this button will display the Context Variable Information screen with the selected context variable details in edit mode. You can make the necessary changes and click Done to save the modified context variable.
Â
You can delete a context variable, by selecting it from the list of existing context variables on the Edit Context Variables screen. You can select multiple context variables to delete, by pressing <CTRL> and the context variables. This selection(s) will enable the Delete Variable button. Clicking this button will delete the selected context variable(s).