This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
bw:using_variables [2019/09/11 10:29] runger [Variables Tool] |
bw:using_variables [2019/10/23 14:46] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ======Introduction (Using Variables)====== | ======Introduction (Using Variables)====== | ||
| - | This document | + | This page describes the use of variables in a Bizweaver workflow. |
| - | + | ||
| - | ====== General Workflow Step Information ====== | + | |
| - | + | ||
| - | * Each workflow step must have a unique name. | + | |
| - | * The application will assign a default name, but we recommend that you change the name to something that helps you understand the purpose of the step as it is used in other steps. | + | |
| - | * The name cannot have spaces or special characters other than and underscore (_) | + | |
| - | * Press < | + | |
| ====== What are Bizweaver Variables? ====== | ====== What are Bizweaver 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**. | + | **“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**. |
| - | **“User Variables”** are defined by the user. These values can be defined in the Variables tool or they can be created using the **// | + | **“[[bw: |
| - | **“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 SQLCommand: | + | **“[[bw: |
| Bizweaver variables are available to other workflow steps that follow the step where they are created. | Bizweaver variables are available to other workflow steps that follow the step where they are created. | ||
| Line 24: | Line 17: | ||
| The **Variables** tool can be used in two ways. First, it can be used to establish constant/ | The **Variables** tool can be used in two ways. First, it can be used to establish constant/ | ||
| - | {{: | + | {{ : |
| - | * “Var1” is the name of the variable. | + | * “Name” is the name of the variable. |
| - | * Click on the gray area at the end of a row (as noted in the red box in the image above) | + | * " |
| <WRAP center round tip 50%> | <WRAP center round tip 50%> | ||
| - | New in v2.4 | + | New in Bizweaver version 2.4 |
| </ | </ | ||
| - | |||
| * Click on the **X** at the right-end of a row to delete a variable. | * Click on the **X** at the right-end of a row to delete a variable. | ||
| * A variable cannot be deleted if it used in any workflow. | * A variable cannot be deleted if it used in any workflow. | ||
| + | |||
| + | Following are examples of using variables. | ||
| + | |||
| + | ====Example 1===== | ||
| + | In this example, the workflow is being called via the Bizweaver API. The __name__ expected to come from the calling application is expected to be " | ||
| + | * **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, variables are defined for login credentials that will be used at various points through the rest of the workflow. | ||
| + | |||
| + | * In this case the __values__ are static. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | The variables are then referenced in a subsequent WebService2 tool step as shown. | ||
| + | |||
| + | {{ : | ||
| ===== Calculations in Variables ===== | ===== Calculations in Variables ===== | ||
| - | Arithmetic calculations can be applied to numeric variable during a workflow execution. This functionality is introduced in Bizweaver | + | Arithmetic calculations can be applied to numeric variable during a workflow execution. This functionality is introduced in Bizweaver |
| 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. | 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. | ||
| Line 45: | Line 62: | ||
| A common use of this functionality is to maintain a counter to control processing or document processing. The calculation will typically be placed inside of a loop construct. | A common use of this functionality is to maintain a counter to control processing or document processing. The calculation will typically be placed inside of a loop construct. | ||
| - | Following is a simple example of how a “counter” calculation is defined. In this case we want to know how many records were passed into a loop from a SQLCommand step. | + | ====Example 3===== |
| + | Following is a simple example of how a “counter” calculation is defined. In this case we want to know how many records were passed into a loop from a SQLCommand step. 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” and the initial value is set to zero (0). | The “counter” variable is first defined in the “Variables_Init” step. In this case the variable is named “ActionCount” and the initial value is set to zero (0). | ||
| - | {{: | + | {{ : |
| The “SQLCommand_getData” step reads a list of data records. This list feeds into a loop. | The “SQLCommand_getData” step reads a list of data records. This list feeds into a loop. | ||
| + | |||
| + | < | ||
| + | Select | ||
| + | | ||
| + | From | ||
| + | (your table) -- table you are pulling the recordNumber from | ||
| + | </ | ||
| The “counter” variable defined initially is incremented by 1 for each record that is passed into the loop. | The “counter” variable defined initially is incremented by 1 for each record that is passed into the loop. | ||
| - | {{: | + | {{ : |
| In this process we are taking whatever value is in “ActionCount” and adding 1 to it. The initial value was zero, so when the first record is processed, “ActionCount” = 0 + 1, so now “ActionCount” = 1. This process continues for each record that is passed into the loop. | In this process we are taking whatever value is in “ActionCount” and adding 1 to it. The initial value was zero, so when the first record is processed, “ActionCount” = 0 + 1, so now “ActionCount” = 1. This process continues for each record that is passed into the loop. | ||
| - | 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. | + | 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. |
| - | This type of processing could be used in conjunction with a Decision such that processing would go in one direction or another based on the number of records found. | + | 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. |
| + | |||
| + | {{ : | ||
| + | |||
| + | This type of processing could be used in conjunction with a **// | ||
| ====== Step Variables ====== | ====== Step Variables ====== | ||
| Line 96: | Line 125: | ||
| The following image illustrates how variables are selected. This process is used in all instances where some variable needs to be referenced. The list of available workflow steps will get larger as you progress through additional steps in the workflow. | The following image illustrates how variables are selected. This process is used in all instances where some variable needs to be referenced. The list of available workflow steps will get larger as you progress through additional steps in the workflow. | ||
| - | {{: | + | {{ : |
| - Position the cursor in the field where the variable is needed. | - Position the cursor in the field where the variable is needed. | ||
| Line 107: | Line 136: | ||
| <WRAP left round tip> | <WRAP left round tip> | ||
| - | When variables are used, they have a very specific name structure, as shown in the “TimeStamp” example | + | When variables are used, they have a very specific name structure, as shown in the **// |
| </ | </ | ||
| Line 117: | Line 146: | ||
| ===== User Variable Example ===== | ===== User Variable Example ===== | ||
| - | In the step marked “3” | + | In a Bizweaver workflow a user can reference variables that are initiated earlier |
| - | {{: | + | The below workflow when processed will now only pull the CardType of " |
| + | |||
| + | {{ : | ||
| + | |||
| + | In the variables tool there is a **User Defined Variable ** of " | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | In the SQL tool step you can reference the **User Defined Variable** of " | ||
| + | |||
| + | {{ : | ||
| So, the SQL statement now uses the value ‘C’ in the variable “UserVariable1.” | So, the SQL statement now uses the value ‘C’ in the variable “UserVariable1.” | ||
| - | {{: | + | {{ : |
| Since the variable value ‘C’ is a string (text), the variable name must be enclosed in single quotes as required by SQL. | Since the variable value ‘C’ is a string (text), the variable name must be enclosed in single quotes as required by SQL. | ||
| Line 129: | Line 168: | ||
| ===== Step Variable Example ===== | ===== Step Variable Example ===== | ||
| - | In the step marked “4” in the illustration above we are writing the output of the SQL step to a file. | + | In this example |
| + | |||
| + | Below is the workflow we are using for the example. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | Note the fields in the SQL statement that will be referenced later. | ||
| + | |||
| + | {{ : | ||
| - | {{: | + | Next when going to the file writer step you will press [F4] and select the variables from the SQL step. |
| - | In this step, we make use of both Step and User variable type. | + | {{ : |
| - | To make the file name unique | + | You can see each step variable in the " |
| - | {{:bw:varimage10.png?479x232}} | + | {{ :bw:varimage9.png?482x384 |
| - | C: | ||
| - | The values in the body section of the file (the actual data records) are step variables that come from the previous SQL Command step (3). | ||
| - | {{: | ||