VIP uses the concept of Arguments (passed by the user when a workflow is invoked either from command line or from Modeller)
Note: The terms Parameter and Argument may be used interchangeably in this document.
Variables can be evaluated using a valid VIP expression e.g. System.DateTime.Now or RandomHelper.GetRandomInt(10, 20) and can be used while generating data for columns.
Both Variables and Parameters can be referred in Column level data generation and Event Hooks and can be combined with other Parameters & Variables as long as the final expression is a valid VB.NET expression.
Using PreProcess Variables to Query Databases and using the Queries in Data Generation functions.
In general, this process is useful to load master data that is used in data generation e.g. list of countries or list of data from any other table in database etc.:
Go to the PreProcessVariables tab
Also remove the following:
varExistingProduct remains in the sheet
Note: The TYPE is very important! See the specified Type in Type Column:
Now we can see the above whenever we are generating a Customer
Go to OrderItem sheet where
The third row contains:
OrderItem ProductID RandomHelper ……….varExisting.Product).id
…but we don't know which product we are using.
So create varProduct variable in PreProcessVariables tab in row
varExisting_Product Scope column has Customer
Using 'Add Model' variables to create PreProcess Variables
Since we deleted all the variables (see previous section) in the PreProcessVariables sheet, we no longer have access to the Supplier variable so if we want to add a variable, we can use 'Add model' variables menu (upper right) by selecting the object that we want to use in the PreProcessVariables sheet.
Add Variable Example
In the PreProcessVariables sheet, add a new row:
The new Model created and it can be utilized:
…but because the Column Name and 'Country' has the Country Column, we must do this:
The Column names must be prepended with an underscore because the table and column cannot be seen otherwise. If you have a look in SQLManager, you will see that the variable in the Database is the same.
Using Parameters to set Max/Min Values for Data Generation
Go to the Product Tab
If we have a look at the UnitPrice. Parameters can be used to supply Values.
In the PreProcessVariable tab, declare 2 new variables:
Define Function column as Parameter, Type Int32 for both.
Set IsParam to YES.
[Filled in values 100, 1000] Use this min/max on price when generating the product.]
[In Product tab–>FunctionParameters Column, UnitPrice row, input parMinPrice and parMaxPrice.] See last figure.
These constants will be used in the generation.
Overview of the Types of PreProcess Variables and Using Scope
Preprocess variables can be very useful and give the user more flexibility in manipulating data. They allow the user to store values/calculated values that they would like to use in another calculation. So for example we could create a preProcessVariable called OrderItemTotal that is the OrderItemPrice * the NumberOfOrderItems :
OrderItemTotal = OrdertemPrice * NumberOfOrderItems
This value could then be saved and used in the calculalation the Total Amount of an Order.
Go to the PreProcess Variable Tab
Look at Type* Columns
Note: Types are 'typical' data types such as 'String', 'Boolean', 'Int32' and any Types defined in Generated Model
Different Models from other Generated Models.
Scope (Scope Column) defines whether to re-initialize or not and whether it should be done once or each time it's used.