Using Event Hooks provides a way to
Call an expression
Save and modify an object using an assigned statement
Save an object back to the DB
Call a VIP flow to do something fancy with it
Call a VIP flow to update an object API to perform an action/do something with it
Let's look at the Event Hooks Tab:
This example, which again refers to the SampleCommerce Database, will use an expression to do two things:
1) Gets a value from an OrderItem value that has been generated
2) Modifies the value based on the Total Amount value that is generated in the OrderItem.
First we create a Lambda Expression in the Expression Column. A Lambda Expression is code that takes in Parameter/s and returns a Value.
The left side specifies which Object needs to be modified.
The right side specifies the calculation function.
A Lambda expression for calculating the Total for an OrderItem is:
var_Order_.Total = lst_OrderItem_.Where(Function x.OrderID =
var_Order_.ID).Sum(Function(a) a.UnitPrice * a.Quantity)
*Lambda Expressions use VB.Net syntax*
To see what the Expression ResultType should be, look back at the Order Table:
Above you can see in the Data_Type column that DECIMAL should be lowercase decimal so that needs to be changed in the EventHooks Table:
Note: Values for Type should be followed by a '?' except for Type 'String'. The '?' notation allows for a NULL value. If this is not done, and a NULL value is encountered an error will be triggered.
Alternatively, the same thing can be achieved using a flow. A FlowPath (FlowPath Column) must be specified in the Type Column. Example (CaluculateTotal.vip)
The Parameters can be specified in EventHooks Parameter.
The Parameter Name (ParameterName Column) must exist in the flow
Specifies which parameter should be passed from the Data Generation flow. It could be
A PreProcessVariable name
Any Parameters supported in vip (and can be looked at)
For more information see the Parameters section.
You can pass either Parameters or Fixed Values to the Flow.
TEST DATA AUTOMATION SYNTHETIC TEST DATA GENERATION