This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
bizweaver:wf_var [2024/09/19 15:50] dlee |
bizweaver:wf_var [2024/09/24 13:54] (current) dlee [String Manipulation] |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| Variables are data values that are held in memory during the execution of a workflow. There are two types of variables in Bizweaver: **User Variables** and **Step Variables**. | Variables are data values that are held in memory during the execution of a workflow. There are two types of variables in Bizweaver: **User Variables** and **Step Variables**. | ||
| - | To access these variables while in any workflow tool, press F4. This will display | + | **User Variables** are defined by the user. These values can be defined |
| - | <WRAP center round info 80%> | + | **Step Variables** are special references created by the Bizweaver |
| - | In Bizweaver | + | |
| + | To access these variables while in any workflow tool, click the Variables icon on the toolbar. This will display the Variable Explorer window. Workflow steps will be displayed in the order they are in the workflow. Workflow | ||
| + | |||
| + | * Use the refresh icon to update the variable in the Variable Explorer as changes are made in the workflow design | ||
| + | * Use drag & drop to place variable in your tool configuration. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ===== Variables Tool ===== | ||
| + | |||
| + | The **Variables** tool can establish constant/ | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | |||
| + | * “Name” is the name of the variable. | ||
| + | * " | ||
| + | * A variable cannot be deleted if it is used in any workflow. | ||
| + | |||
| + | Following are examples of using variables. | ||
| + | |||
| + | ====Example 1===== | ||
| + | In this example, the workflow | ||
| + | * **The name is case sensitive**. | ||
| + | * The __value__ field is blank because the value to be used will be sent in the API call to Bizweaver. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | The variable is then referenced in a subsequent SQL: Reader step. | ||
| + | * Any time a variable is referenced using <F4> in a SQL step, the string must be enclosed in single quotes as shown. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | ====Example 2===== | ||
| + | In this example, | ||
| + | |||
| + | * In this case, the __values__ are static. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | The variables are then referenced in a subsequent WebService2 tool step as shown. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | |||
| + | ====Example 3===== | ||
| + | <WRAP center round tip 80%> | ||
| + | Arithmetic calculations can be applied to a numeric variable during workflow execution. | ||
| + | |||
| + | A calculation using a variable is done by using the “EVAL{}” function in the “Value” of the variable. The calculation can be done against both user and step variables. The calculation is placed within the braces {} as shown in the examples. | ||
| </ | </ | ||
| - | To select variables, select | + | Following is a simple example of how a “counter” calculation is defined. We want to know how many records were passed into a loop from an SQLCommand step in this case. For this example, we will use a simple statement. |
| + | |||
| + | {{ : | ||
| + | |||
| + | The “counter” variable is first defined in the “Variables_Init” step. In this case, the variable is named “ActionCount, | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | The “SQLCommand” step reads a list of data records. This list feeds into a loop. | ||
| + | |||
| + | < | ||
| + | SELECT | ||
| + | | ||
| + | FROM | ||
| + | [yourTable] -- table you are pulling | ||
| + | </ | ||
| + | |||
| + | The “counter” variable defined initially is incremented by 1 for each record passed into the loop. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | In this process, we are taking whatever value is in “ActionCount” | ||
| + | |||
| + | When all records have been read, the loop ends. At this point, the “ActionCount” variable will contain the number of records that were passed into the loop. | ||
| + | |||
| + | The final step of the workflow writes out a file with the record count information. Below is the file writer step information to write the information to a text file. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | |||
| + | ===== Step Variables ===== | ||
| + | |||
| + | Step variables are created by Bizweaver and do not require any user action. These variables are available | ||
| + | |||
| + | ===== Special Note for Step Variables and Loops ===== | ||
| + | |||
| + | As noted, step variables | ||
| + | |||
| + | The step named “SQL Command_getData” uses the SQL statement: | ||
| + | |||
| + | <code sql> | ||
| + | | ||
| + | | ||
| + | FROM OCRD | ||
| + | </ | ||
| + | |||
| + | This produces a list of records that feeds into the loop “Loop_ProcessRecords.” The step variable | ||
| + | |||
| + | < | ||
| + | |||
| + | This step variable is used in the FileWriter_VariableTest step. | ||
| + | |||
| + | The list contains the values C1, C2, and C3. | ||
| + | |||
| + | The first time the file writer sees the step variable, the value will be the first record | ||
| + | |||
| + | When the file writer step sees the same step variable, the next record will be returned from the SQL select statement or C2 received from the loop processing. This cycle continues for each record read into the loop processing. | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ==== Example 4 ==== | ||
| + | |||
| + | In this example, we are writing the output | ||
| + | |||
| + | Below is the workflow we are using for the example. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | Note the fields in the SQL statement that will be referenced later. | ||
| - | {{ :bw2:bizweavervarmanager1.png |}} | + | {{ :bw2:bizweavervartool14.png |}} |
| - | **User Variables** are defined by the user. These values can be defined in the **//[[bw2: | + | Next, you will press [F4] and select |
| - | **Step Variables** are special references created by the Bizweaver application. Most Bizweaver workflow tools create these variables as the step is executed. An example of this would be a reference to an output column from a SQL/HANA Tool or File Reader step. | + | {{ : |
| - | Bizweaver variables are available to other workflow steps that follow the step where they are created. | + | You can see each step variable in the " |
| - | More information is found on the **//[[bw2:using_variables|Using Variables]]// | + | {{ :bw2:bizweavervartool16.png |}} |
| =====String Manipulation===== | =====String Manipulation===== | ||
| - | Starting in Bizweaver 2.7.2, the functionality to modify variables was introduced. | + | This allows a user to manipulate all variables that are inserted in a specific step and is accessed by pressing F4 |
| - | {{ :bw2:bizweavervarmanager1.png |}} | + | {{ :bizweaver:wf_var03.png |}} |
| * **Escape:** Selecting this checkbox will enable or disable the escaping functionality. | * **Escape:** Selecting this checkbox will enable or disable the escaping functionality. | ||