Generating random java data
The following scenario creates a two-component Job, generating 50 rows structured as follows: a randomly picked-up ID in a 1-to-3 range, a random ascii First Name and Last Name generation and a random date taken in a defined range.
For more technologies supported by Talend, see Talend components.
-
Drop a tRowGenerator and a tLogRow component from the Palette to the design workspace.
-
Right-click tRowGenerator and select Row > Main. Drag this main row link onto the tLogRow component and release when the plug symbol displays.
-
Double-click tRowGenerator to open the Editor.
-
Define the fields to be generated.
-
The random ID column is of integer type, the First and Last names are of string type and the Date is of date type.
-
In the Function list, select the relevant function or set on the three dots for custom function.
-
On the Function parameters tab, define the Values to be randomly picked up.
-
First_Name and Last_Name columns are to be generated using the getAsciiRandomString function that is predefined in the system routines. By default the length defined is 6 characters long. You can change this if need be.
-
The Date column calls the predefined getRandomDate function. You can edit the parameter values in the Function parameters tab.
-
Set the Number of Rows to be generated to 50.
-
Click OK to validate the setting.
-
Double-click tLogRow to view the Basic settings. The default setting is retained for this Job.
-
Press F6 to run the Job.
The 50 rows are generated following the setting defined in the tRowGenerator editor and the output is displayed in the Run console.