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/10/23 11:30] akoehler [Example 1] |
bw:using_variables [2019/10/23 14:46] (current) |
||
|---|---|---|---|
| Line 48: | Line 48: | ||
| * In this case the __values__ are static. | * In this case the __values__ are static. | ||
| - | {{: | + | {{ : |
| - | The variables are then referenced in a subsequent WebService2 step as shown. | + | The variables are then referenced in a subsequent WebService2 |
| - | {{: | + | {{ : |
| ===== 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 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. | ||
| - | {{: | + | {{ : |
| 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. |
| + | |||
| + | The final step of the workflow writes out a file with the record count information. | ||
| + | |||
| + | {{ : | ||
| - | 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 **// |
| ====== 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. | ||
| - | {{: | + | {{ : |
| - 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 | + | When variables are used, they have a very specific name structure, as shown in the **// |
| </ | </ | ||
| Line 134: | 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 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 |
| + | |||
| + | 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). | ||
| - | {{: | ||