Creating random test data using lookups
This simple technique shows how we can randomly assign values using lookups.
Getting ready
Open the jo_cook_ch10_0120_randomTestDataLookups
job.
How to do it...
The steps for creating random test data using lookups are as follows:
- Open
tMap
. - Open the
tMap
settings for theproductData
input flow. - Change the Match Model to First Match.
- For the Expr. key for productData, add the code:
Numeric.random(1,15)
- Drag all columns from both inputs to the output.
- Your
tMap
should now look like this: - Exit
tMap
and run the job.
How it works...
As you will see from the output, the job will add a random product ID and product description to each order item row.
The match model of First Match ensures that only one match is returned for each order item line.
The Numeric.random(1,15)
function returns a value from 1 through to 15, which is the number of products in the products list CSV file.
Thus the process will generate a random number for each order line and then use this random number...