Wiki

Scale Your Enterprise

User Tools

Site Tools


bw: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
bw:using_variables [2019/10/23 11:31]
akoehler [Example 2]
bw:using_variables [2019/10/23 14:46] (current)
Line 56: Line 56:
 ===== Calculations in Variables ===== ===== Calculations in Variables =====
  
-Arithmetic calculations can be applied to numeric variable during a workflow execution. This functionality is introduced in Bizweaver v2.1.0.+Arithmetic calculations can be applied to numeric variable during a 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.
Line 62: 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.
  
-{{:bw:varimage3.png?576x69}}+{{  :bw:varimage3.png?576x69  }}
  
 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?303x171}}+{{  :bw:varimage4.png?303x171  }}
  
 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.
 +
 +<code>
 +Select 
 +     (recordNumber) -- This will be a record number from your table that you are using
 +From
 +    (your table) -- table you are pulling the recordNumber from
 +</code>
  
 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.
  
-{{:bw:varimage5.png?403x166}}+{{  :bw:varimage5.png?403x166  }}
  
 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.  
 + 
 +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?nolink |}}
  
-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.+This type of processing could be used in conjunction with a **//[[bw: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 113: 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?455x253}}+{{  :bw:varimage6.png?455x253  }}
  
   - Position the cursor in the field where the variable is needed.   - Position the cursor in the field where the variable is needed.
Line 124: 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 above. While it is possible to enter the variable name manually, this approach is not recommended.+When variables are used, they have a very specific name structure, as shown in the **//[[bw: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 syntax of the variable is the same as it is in the step, this includes capitalization.
  
 </WRAP> </WRAP>
Line 134: Line 146:
 ===== User Variable Example ===== ===== User Variable Example =====
  
-In the step marked “3” in the illustration above, a SQL statement is being used to report 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 that are 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.
  
-{{:bw:varimage7.png?576x231}}+The below workflow when processed will now only pull the CardType of "C" which is set in the "Variables_Init" step. 
 + 
 +{{ :bw:uservariablesexamplewf.png?nolink |}} 
 + 
 +In the variables tool there is a **User Defined Variable ** of "UserVariable1" 
 + 
 +{{ :bw:variablestoolscreen.png?569x110 |}} 
 + 
 +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 in the left menu and selecting the correct variable from the list of variables on the right menu. 
 + 
 +{{  :bw:varimage7.png?576x231  }}
  
 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?569x110}}+{{  :bw:varimage8.png?569x110  }}
  
 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 146: 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 we are writing the output of the SQL step to a file. 
 + 
 +Below is the workflow we are using for the example. 
 + 
 +{{ :bw:stepvariablesworkflow.png?nolink |}} 
 + 
 +Note the fields in the SQL statement that will be referenced later. 
 + 
 +{{ :bw:stepvariablessql.png?482x384 |}}
  
-{{:bw:varimage9.png?482x384}}+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.+{{  :bw:varimage11.png?483x298  }}
  
-To make the file name unique each time it is created, we use the “time stamp” user variable created by the VBScript step. As noted earlier, we can use either the output name from the VBScript step, or the value created in the Variables step. For this example, the value from the VBScript step is used.+You can see each step variable in the "Body" section of the FileWriter Tool.
  
-{{:bw:varimage10.png?479x232}}+{{  :bw:varimage9.png?482x384  }}
  
-C:\Shared\Bizweaver\DataOut\Filewriter_VariablesTest_WorkFlow(VBScript).Get(TimeValue).txt 
  
-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). 
  
-{{:bw:varimage11.png?483x298}} 
  
bw/using_variables.1571844699.txt.gz · Last modified: 2019/10/23 11:31 by akoehler