This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
bw2:using_variables [2020/12/15 11:48] akoehler [What are Bizweaver Variables?] |
bw2:using_variables [2023/12/19 09:02] (current) wgates |
||
|---|---|---|---|
| Line 5: | Line 5: | ||
| ====== What are Bizweaver Variables? ====== | ====== What are Bizweaver Variables? ====== | ||
| - | **“Variables”** are data values | + | **“Variables”** are data values held in memory during the execution of a workflow. There are two types of variables in Bizweaver: **User Variables** and **Step Variables**. |
| - | **“[[bw2: | + | **“[[bw2: |
| - | **“[[bw2: | + | **“[[bw2: |
| 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 15: | Line 15: | ||
| ====== Variables Tool ====== | ====== Variables Tool ====== | ||
| - | The **Variables** tool can be used in two ways. First, it can be used to establish constant/ | + | The **Variables** tool can establish constant/ |
| - | {{ :bw:using_variables.png? | + | {{ :bw2:bizweavervartool1.png |}} |
| * “Name” is the name of the variable. | * “Name” is the name of the variable. | ||
| - | * " | + | * " |
| <WRAP center round tip 50%> | <WRAP center round tip 50%> | ||
| Line 27: | Line 27: | ||
| * 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 is used in any workflow. |
| Following are examples of using variables. | Following are examples of using variables. | ||
| Line 36: | Line 36: | ||
| * The __value__ field is blank because the value to be used will be sent in the API call to Bizweaver. | * The __value__ field is blank because the value to be used will be sent in the API call to Bizweaver. | ||
| - | {{ :bw:using_variables2a.png? | + | {{ :bw2:bizweavervartool2.png |}} |
| - | The variable is then referenced in a subsequent SQL:Reader step. | + | 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. | + | * Any time a variable is referenced using <F4> in a SQL step, the string must be enclosed in single quotes as shown. |
| - | {{ :bw:using_variables2b.png? | + | {{ :bw2:bizweavervartool3.png |}} |
| ====Example 2===== | ====Example 2===== | ||
| - | In this example, variables are defined for login credentials | + | In this example, variables are defined for login credentials used at various points |
| - | * In this case the __values__ are static. | + | * In this case, the __values__ are static. |
| - | {{ :bw:using_variables3a.png? | + | {{ :bw2:bizweavervartool4.png |}} |
| The variables are then referenced in a subsequent WebService2 tool step as shown. | The variables are then referenced in a subsequent WebService2 tool step as shown. | ||
| - | {{ :bw:using_variables3b.png? | + | {{ :bw2:bizweavervartool5.png |}} |
| ===== Calculations in Variables ===== | ===== Calculations in Variables ===== | ||
| - | Arithmetic calculations can be applied to numeric variable during | + | Arithmetic calculations can be applied to a numeric variable during workflow execution. This functionality is introduced in Bizweaver version 2.1.0. |
| 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. | ||
| - | A common | + | Everyday |
| ====Example 3===== | ====Example 3===== | ||
| - | Following is a simple example of how a “counter” calculation is defined. | + | Following is a simple example of how a “counter” calculation is defined. |
| - | {{ :bw:varimage3.png? | + | {{ :bw2:bizweavervartool6.png |}} |
| - | 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). |
| - | {{ :bw:varimage4.png? | + | {{ :bw2:bizweavervartool7.png |}} |
| - | The “SQLCommand_getData” step reads a list of data records. This list feeds into a loop. | + | The “SQLCommand” step reads a list of data records. This list feeds into a loop. |
| < | < | ||
| - | Select | + | SELECT |
| - | (recordNumber) -- This will be a record number from your table that you are using | + | [recordNumber] -- This will be a record number from your table that you are using |
| - | From | + | FROM |
| - | | + | |
| </ | </ | ||
| - | The “counter” variable defined initially is incremented by 1 for each record | + | The “counter” variable defined initially is incremented by 1 for each record passed into the loop. |
| - | {{ :bw:varimage5.png? | + | {{ :bw2:bizweavervartool8.png |}} |
| - | 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. | + | 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. | 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. | ||
| - | {{ :bw:evalfilewriterstep.png? | + | {{ :bw2:bizweavervartool9.png |}} |
| - | This type of processing could be used in conjunction with a **// | ||
| ====== Step Variables ====== | ====== Step Variables ====== | ||
| Line 100: | Line 99: | ||
| ===== Special Note for Step Variables and Loops ===== | ===== Special Note for Step Variables and Loops ===== | ||
| - | As noted, step variables are created when a step executes. When the step that creates | + | As noted, step variables are created when a step executes. When the step that makes the variable feeds a Bizweaver loop, the same variable's value will change for each loop cycle. Following is an example of this using the workflow shown above. For this example, we will focus on the “CardCode” value. |
| The step named “SQL Command_getData” uses the SQL statement: | The step named “SQL Command_getData” uses the SQL statement: | ||
| - | <code sql>select | + | <code sql>SELECT |
| - | t0.CardCode, | + | CardName, |
| - | from OCRD t0 | + | CardType |
| + | FROM OCRD | ||
| </ | </ | ||
| This produces a list of records that feeds into the loop “Loop_ProcessRecords.” The step variable created for “CardCode” is: | This produces a list of records that feeds into the loop “Loop_ProcessRecords.” The step variable created for “CardCode” is: | ||
| - | < | + | < |
| This step variable is used in the FileWriter_VariableTest step. | This step variable is used in the FileWriter_VariableTest step. | ||
| Line 117: | Line 117: | ||
| The list contains the values C1, C2, and C3. | The list contains the values C1, C2, and C3. | ||
| - | The first time the file writer | + | The first time the file writer sees the step variable, the value will be the first record in the list or C1. Then, when the end of the loop processing is reached, the next record from the list is read. |
| - | Now when the file writer step sees the same step variable, the value will be the next record | + | When the file writer step sees the same step variable, the next record |
| ====== Using Variables ====== | ====== Using Variables ====== | ||
| Line 125: | 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. | ||
| - | {{ :bw:varimage6.png? | + | {{ :bw2:bizweavervarmanager1.png |}} |
| - Position the cursor in the field where the variable is needed. | - Position the cursor in the field where the variable is needed. | ||
| - Press **F4** | - Press **F4** | ||
| - | - The ‘Choose Variable” | + | - The ‘Choose Variable” |
| - | - Workflow steps prior to the current one are listed in the left-hand panel. | + | - Workflow steps before |
| - Click on the appropriate step name. | - Click on the appropriate step name. | ||
| - | - Available variables for the selected step are displayed | + | - Available variables for the selected step are expanded for the step in the right-hand panel. |
| - | - Select the desired variable and click [OK] to select the value into the target field. | + | - Select the desired variable and double |
| <WRAP left round tip> | <WRAP left round tip> | ||
| - | When variables are used, they have a very specific | + | When variables are used, they have a particular |
| </ | </ | ||
| Line 142: | Line 142: | ||
| ====== Examples ====== | ====== Examples ====== | ||
| - | Once a variable has been created it can be used in any subsequent workflow step. | + | Once a variable has been created, it can be used in any subsequent workflow step. |
| ===== User Variable Example ===== | ===== User Variable Example ===== | ||
| - | In a Bizweaver workflow a user can reference variables | + | In a Bizweaver workflow, a user can reference variables initiated earlier in the workflow using the variables |
| - | The below workflow | + | When processed, the below workflow will only pull the CardType of "C," set in the " |
| - | {{ :bw:uservariablesexamplewf.png? | + | {{ :bw2:bizweavervartool11.png |}} |
| - | In the variables tool there is a **User Defined Variable ** of " | + | In the variables tool, there is a **User-Defined Variable ** of " |
| - | {{ :bw:variablestoolscreen.png? | + | {{ :bw2:bizweavervartool12.png |}} |
| - | In the SQL tool step you can reference the **User Defined Variable** of " | + | In the SQL tool step, you can reference the **User-Defined Variable** of " |
| - | {{ :bw:varimage7.png? | + | {{ :bw2:bizweavervarmanager2.png |}} |
| 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.” | ||
| - | {{ :bw:varimage8.png? | + | {{ :bw2:bizweavervartool14.png |}} |
| 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 168: | Line 168: | ||
| ===== Step Variable Example ===== | ===== Step Variable Example ===== | ||
| - | In this example we are writing the output of the SQL step to a file. | + | In this example, we are writing the output of the SQL step to a file. |
| Below is the workflow we are using for the example. | Below is the workflow we are using for the example. | ||
| - | {{ :bw:stepvariablesworkflow.png? | + | {{ :bw2:bizweavervartool17.png |}} |
| Note the fields in the SQL statement that will be referenced later. | Note the fields in the SQL statement that will be referenced later. | ||
| - | {{ :bw:stepvariablessql.png? | + | {{ :bw2:bizweavervartool14.png |}} |
| - | Next when going to the file writer step you will press [F4] and select the variables | + | Next, you will press [F4] and select the SQL step variables |
| - | {{ :bw:varimage11.png? | + | {{ :bw2:bizweavervarmanager3.png |}} |
| You can see each step variable in the " | You can see each step variable in the " | ||
| - | {{ :bw:varimage9.png? | + | {{ :bw2:bizweavervartool16.png |}} |
| + | |||
| + | ======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. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | * **Escape:** Selecting this checkbox will enable or disable the escaping functionality. | ||
| + | * Only one of these can be selected at once, and they only apply in the step in which they are enabled. | ||
| + | * **JSON:** Selecting this will escape reserved characters for a JSON file. See the table below for more information. | ||
| + | * **XML:** Selecting this will escape any reserved characters for an XML file. See the table below for more information. | ||
| + | * **SQL:** Selecting this will escape reserved characters for SQL Server see table below for more information | ||
| + | * **Replace empty values with NULL:** This will take any empty strings or blanks ex '' | ||
| + | * This works independently of the Escape functions. | ||
| + | |||
| + | ^**JSON Reserved Character** | ||
| + | |Backspace | ||
| + | |Form feed | ||
| + | |Newline | ||
| + | |Carriage return | ||
| + | |Tab |A tab in a string | ||
| + | |" | ||
| + | |\ |A backslash | ||
| + | |||
| + | ^**XML Reserved Character** | ||
| + | |< |Less than sign |& | ||
| + | |> | ||
| + | |& | ||
| + | |" | ||
| + | |' | ||
| + | ^**SQL Reserved Character** | ||
| + | |' | ||