Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Let's have a look at the following example with two translators: shared_var_test_1 and shared_var_test_2. We want to share a variable (called variableA) from one translator to another.

Image Removed

Step-by-step instruction to do that:

Double-click first translator to open its worksheet and drop the Variable shape from the left panel ToolBox in CONTROL OBJECTS group:

Image Removed

By default, the variable is named as var. To set another name, click to the shape, and change the property Name in the left panel.

Image Removed

In our example we want to rename it to variableA.

To set a value for the variable, click the shape and put the value to the fx input on top of the workspace using quotes.

Image Removed

Update the default variable varTaskParamsTo do that, three steps have to be taken

Step 1: Declare the variable as "output variable" in the source shape

This is done simply by typing the variable name (or comma-separated list of names) in the OutParams property of the source shape:

Image Added


Step 2. Instruct the target shape to receive this new variable as input.

Click on the second task and in the CustomCMParams property set the name of the variable in the first column.

It does not have to be same variableA. You can use another alias for the target shape.

In the second column you should use the following construct:

Code Block
EXPR#:param_TASK_[name_of_task]_[original_name_of_shared_parameter]:

Image Added

EXPR#:param_TASK_ is a required prefix. [name_of_task] is the name of the task where shared variable was created (shared_var_test_1 in our example). And variableA is the original name of the shared variable.

Final expression for our example:

Code Block
EXPR#:param_TASK_shared_var_test_1_variableA: 

Image Added


Step 3. In the source shape, make the variable visible to the whole workflow.

This step differs depending on the type of source shape.

Expand corresponding link below to see specific details


Expand
titleIn case of streaming translator (click to expand):

Drop the Code shape from left panel in ADVANCED group and set value of the Code shape as 

Code Block
:varTaskParams: := :varTaskParams: + 'variableA;' + :variableA: + '!'

If you need to share more variables you can add them to the Code shape using syntax variable_name;variable_value!. For example, if we have another variable count to share, the Code shape value is set like this:

Code Block
:varTaskParams: := :varTaskParams: + 'variableA;' + :variableA: + '!' + 'count;' + :count: + '!'


Your final picture should look like this


Image Added


Image Removed

If you add several variables, use comma separator in OutParams property, for example, variableA,variable1,variable2,…

Now we can call variable variableA like this EXPR#:param_variableA:

Click to the second translator and in the property CustomCMParams set the name of the variable in first column, which you will use in the translator. It is not necessary to use the original name variableA in first column.

In the second column you must use the following construction:

Code Block
EXPR#:param_TASK_[name_of_task]_[original_name_of_shared_parameter]:

Image Removed

EXPR#:param_TASK_ is a required prefix. [name_of_task] is the name of the task where shared variable was created (shared_var_test_1 in our example). And variableA is the original name of the shared variable.

Final expression for our example:

Code Block
EXPR#:param_TASK_shared_var_test_1_variableA: 

Image Removed

Double click second translator. Here you can use :param_it_is_shared_var: construction.

param_ is a required prefix, then goes the name which you set in CustomCMParams property earlier.

Workspace of the second translator.

Image Removed

We drop a STATUS shape to check the value of the variable.

Status after workflow launch

...

:varTaskParams

:

:= :varTaskParams: + 'variableA;' + :variableA: + '!'


Expand
titleIn case of transform translator (click to expand):

Step A:  Drop a Variable shape onto the worksheet. It represents the variable you are going to share. Drop a Call Include shape from the left panel in ADVANCED group and click the Browse button next to the File property in the right panel

Image RemovedImage Removed

Select w_config.inc file in 

Image Added

Step B: Drop a Call Include shape from the Advanced section of the toolbox, and type the following text in its File property:

../eagle_ml-2-0_cm

folder

Image Removed

/w_config.inc

Image Added

Or, click the "ellipsis" button to select the file from the open dialog.

Image Added


Step C: Drop the Code shape from left panel in group ADVANCED after Call Include shape with w_config.inc the variable box and set value of the Code shape as

Code Block
languagetext
IF Find(:FILE_NAME:, :corrIdSep:) = -1 AND Find(:FILE_NAME:, '-', 2) != -1 AND Find(:FILE_NAME:, '_') != -1 THEN [ :CorrelationId: := SubString(:FILE_NAME:, Find(:FILE_NAME:, '-', 0, 2) + 1); :CorrelationId: := SubString(:CorrelationId:, 0, Find(:CorrelationId:, '_')); ];

Image RemovedImage Added


Drop a Code shape, then Step D: Drop Call Include shape and click Browse button next to the File property in the right panel

Image Removed

Select get_w_state.inc file in 

from the Advanced section of the toolbox, and type the following text in its File property:

../eagle_ml-2-0_cm

folder

/get_w_state.inc

Image Added

Or, click the "ellipsis" button to select the file from the open dialog.


Step E: Drop a another Code shape and set its value as

Code Block
languagetext
Info

If you need to share more variables you can add them to the Code shape using variable_name;variable_value! syntax. For example, if we have another variable count to share, then the Code shape value will be as follows

Code Block
languagetext
:varTaskParams: := IF (find(:varTaskParams: +, 'variableA;' +) = -1) then :variableAvarTaskParams: + '!':= :varTaskParams: + 'countvariableA;' + :countvariableA: + '!';



Step F: Drop a the second Call Include shape and click Browse button next to the File property in the right panel

Image Removed

Select upd_w_state.inc file from type or select  file ../eagle_ml-2-0_cmfolder/upd_w_state.inc


...

after all these additions you should have something similar to this:


Image Added



To verify that new variables are passed to the target shape, run your workflow and check the Control Message tab in the Monitoring Tool.

You should be able to see your new variables as input parameters in the RTR:

Image Added