Wiki

Scale Your Enterprise

User Tools

Site Tools


bw2:using_variables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
bw2:using_variables [2021/02/10 17:34]
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 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 held in memory during the execution of a workflow. There are two types of variables in Bizweaver: **User Variables** and **Step Variables**.
  
 **“[[bw2:using_variables#User Variable Example|User Variables]]”** are defined by the user. These values can be defined in the Variables tool or they can be created using the **//[[bw2:vbscript_tool|VBScript]]//** tool. **“[[bw2:using_variables#User Variable Example|User Variables]]”** are defined by the user. These values can be defined in the Variables tool or they can be created using the **//[[bw2:vbscript_tool|VBScript]]//** tool.
Line 15: Line 15:
 ====== Variables Tool ====== ====== Variables Tool ======
  
-The **Variables** tool can be used in two ways. First, it can establish constant/static values to be used in the following workflow steps. Second, it can be used to capture values from previous workflow steps. The second option is not often used since values from previous steps can be referenced directly.+The **Variables** tool can establish constant/static values to be used in the following workflow steps.
  
 {{ :bw2:bizweavervartool1.png |}} {{ :bw2:bizweavervartool1.png |}}
Line 44: Line 44:
  
 ====Example 2===== ====Example 2=====
-In this example, variables are defined for login credentials used at various points through the rest of the workflow.+In this example, variables are defined for login credentials used at various points throughout the workflow.
  
   * In this case, the __values__ are static.  They represent login information used to access the SAP HANA Service Layer API.   * In this case, the __values__ are static.  They represent login information used to access the SAP HANA Service Layer API.
Line 63: Line 63:
  
 ====Example 3===== ====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 an SQLCommand step. For this example, we will use a simple statement.+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.
  
 {{ :bw2:bizweavervartool6.png |}} {{ :bw2:bizweavervartool6.png |}}
Line 71: Line 71:
 {{ :bw2:bizweavervartool7.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.
  
 <code> <code>
-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 
-    (your table) -- table you are pulling the recordNumber from+    [yourTable] -- table you are pulling the recordNumber from
 </code> </code>
  
Line 92: Line 92:
 {{ :bw2:bizweavervartool9.png |}} {{ :bw2:bizweavervartool9.png |}}
  
-This type of processing could be used in conjunction with a **//[[bw2:decision_tool#Decision Tool|Decision Tool]]//** such that processing would go in one direction or another based on the number of records found. 
  
 ====== Step Variables ====== ====== Step Variables ======
Line 104: Line 103:
 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 CardCode,  
-t0.CardCode, t0.CardName, t0.CardType +   CardName,  
-from OCRD t0+   CardType 
 +FROM OCRD
 </code> </code>
  
 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:
  
-<code>WorkFlow(SQLCommand_getData).Get({FIELD_CardCode})</code>+<code>WorkFlow(SQLCommand).Get({FIELD_CardCode})</code>
  
 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 step 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.+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.
  
 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. 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.
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.
  
-{{ :bw2:bizweavervartool10.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” dialog is presented+      - The ‘Choose Variable” flyout is opened
-  - Workflow steps before the current one are listed in the left-hand panel.+  - Workflow steps before the current one are listed in the right-hand panel.
       - Click on the appropriate step name.       - Click on the appropriate step name.
-  - Available variables for the selected step are displayed in the right-hand panel. +  - 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 click.
 <WRAP left round tip> <WRAP left round tip>
-When variables are used, they have a very specific name structure, as shown in the **//[[bw2:using_variables#Special Note for Step Variables and Loops|Using Variables with loops code snippet above]]//**. While it is possible to enter the variable name manually, this approach is not recommended. If this approach is taken, make sure that the variable's syntax is the same as it is in the step, which includes capitalization.+When variables are used, they have a particular name structure, as shown in the **//[[bw2:using_variables#Special Note for Step Variables and Loops|Using Variables with loops code snippet above]]//**. While it is possible to enter the variable name manually, this approach is not recommended. If this approach is taken, make sure that the variable's syntax is the same as it is in the step, including capitalization.
  
 </WRAP> </WRAP>
Line 146: Line 146:
 ===== User Variable Example ===== ===== User Variable Example =====
  
-In a Bizweaver workflow, a user can reference variables initiated earlier in the workflow using the variables tool. In this example, a SQL statement is being used to pull information from the database. We want to limit the data based on a certain value. In this example, a value from the “Variables” step is used.+In a Bizweaver workflow, a user can reference variables initiated earlier in the workflow using the variables selector. In this example, a SQL statement is being used to pull information from the database. We want to limit the data based on a certain value. In this example, a value from the “Variables” step is used.
  
 When processed, the below workflow will only pull the CardType of "C," set in the "Variables_Init" step. When processed, the below workflow will only pull the CardType of "C," set in the "Variables_Init" step.
Line 156: Line 156:
 {{ :bw2:bizweavervartool12.png |}} {{ :bw2:bizweavervartool12.png |}}
  
-In the SQL tool step, you can reference the **User-Defined Variable** of "UserVariable1" by pressing [F4] in the SQL tool and navigating to the Variables option on the left menu and selecting the correct variable from the list of variables on the right menu.+In the SQL tool step, you can reference the **User-Defined Variable** of "UserVariable1" by pressing [F4] in the SQL toolnavigating to the left menuand selecting the correct Variables option variable from the list of variables on the right menu.
  
-{{ :bw2:bizweavervartool13.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.”
Line 178: Line 178:
 {{ :bw2:bizweavervartool14.png |}} {{ :bw2:bizweavervartool14.png |}}
  
-Next, when going to the file writer step, you will press [F4] and select the SQL step variables.+Next, you will press [F4] and select the SQL step variables when going to the file writer step.
  
-{{ :bw2:bizweavervartool15.png |}}+{{ :bw2:bizweavervarmanager3.png |}}
  
 You can see each step variable in the "Body" section of the FileWriter Tool. You can see each step variable in the "Body" section of the FileWriter Tool.
Line 186: Line 186:
 {{ :bw2:bizweavervartool16.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.
 +
 +{{ :bw2:bizweavervarmanager1.png |}}
 +
 +  * **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 '' and replace it with NULL
 +    * This works independently of the Escape functions.
 +
 +^**JSON Reserved Character**     ^**Explanation**                                ^**Escaped Value**^
 +|Backspace                   |A backspace in any text in a string           |\b|
 +|Form feed                   |Advanced to the next page                     |\f|
 +|Newline                     |A new line in a string                        |\n|
 +|Carriage return             |A carriage return in a string                 |\r|
 +|Tab                         |A tab in a string                             |\t|
 +|"                           |A double quote                                |\"|
 +|\                           |A backslash                                   |\\|
 +
 +^**XML Reserved Character**     ^**Explanation**                             ^**Escaped Value**^
 +|<                             |Less than sign                              |&lt;|
 +|>                             |Greater than sign                           |&gt;|
 +|&                             |Ampersand                                   |&amp;|
 +|"                             |Double quote                                |&quot;|
 +|'                             |Single quote                                |&apos;|
 +
 +^**SQL Reserved Character**     ^**Explanation**                             ^**Escaped Value**^
 +|'                             |Single quote                                |\'|
  
  
  
bw2/using_variables.1612996460.txt.gz · Last modified: 2021/02/10 17:34 by akoehler