Lesson Summary

In this POC, the three Domains that represent the three tables in the database, do not have a direct foreign key relationship to each other. In order to generate data with full referential integrity across all three Domains, we need to create a Domain that becomes the parent to our three Domains.  We will call this Domain the Master Domain. The Master Domain will control data insertions and data updates.


Master Domain 

The master Domain will contain three Attributes:

  • query - used to select the externalIds from the alpha.user table to control data insertions and data updates
  • firstName - used to generate the random first names for all three Domains with the same seed value
  • lastName  - used to generate the random last names for all three Domains with the same seed value 


Lesson Steps

Step 1 - Use the GenRocket ScratchPad to Create the Master Domain

  • On the Project Dashboard, go to the Domains panel 
  • Click the New Domain button
  • Click the Scratch Pad menu option


Step 2 - Create a Master Domain from Scratch

  • Set the Name parameter to master
  • Set the Delimeter pulldown to LineFeed
  • Type the following the lines into the Attribute text area
    • query
    • externalId
    • firstName
    • lastName
    • username
  • Click the Create with Generators button


Step 3 - Preview and Save

  • Click the Save button


Step 4 - Globally Edit One or More Attributes

Normally, when we have a Domain with a lot of Attributes, we would want to use the editor to modify more than one Attribute at the same time.  In this instance, we don't need to; we just wanted to use the Scratch Pad to quickly create our Domain.

  • Click the Close button.


Step 5 - Set the Master Seed

Since the Master Domain will share its generated data with any child Domains, we want to set the Master.seed global variable to ensure that any of its Attributes that generate random data (e.g. firstName and lastName), generate the same data for all child Domains.

  • On the Master Domain's Main tab, click the global.Master.seed's edit icon


Step 6 - Set the global.Master.seed's value

  • Set the Value parameter to 54321
    • The value, 54321, is of no significance, it's just a seed to ensure that random data is always generated the same. 
  • Click the Save button


Step 7 - Go to the query Attribute's Generator

  • In the Domains Attribute list panel, click on the query Attribute


Step 8 - Modify Generator Parameters

  • Set the setLoop parameter to True
  • Enter the following SQL statement into the query parameter's text area
    • select external_id from alpha.user order by external_id
  • Enter the following values into the list parameter (these values are used for preview purposes only)
    • 10001
    • 10002
    • 10003
  • Click the Save Generator button


Step 9 - Setting the resourceName parameter

  • Double click the resourceName parameter


Step 10 - Selecting from  Resources

  • Click the Resources tab


Step 11 - Selecting a Resource

  • Click the resource.jdbc.config link or click the + icon
  • Click the Save Generator button


Step 12 - Go to the firstName Attribute's Generator

  • In the Domains Attribute list panel, click on the firstName Attribute


Step 13 - Modify Generator Parameters

  • Set the nameType to firstName
  • Set the sortOrder to RandomsortOrder to Random
  • Click the Save Generator button


Step 14 - Setting the seed parameter

In order to generate the same random set of firstNames we need to set seed parameter. firstNames we need to set seed parameter. 

We will set it to use the Master.seed variable.

  • Double click the seed parameter


Step 15 - Selecting from Global Variables

  • Click the Global Variables tab


Step 16 - Selecting a Global Variable

  • Click the global.Master.seed link or click the + icon


Step 17 - Go to the lastName Attribute's Generator

  • In the Domains Attribute list panel, click on the lastName Attribute


Step 18 - Modify Generator Parameters

  • Set the nameType to lastName
  • Set the sortOrder to Random
  • Set the seed to #{global.Master.seed}
  • Click the Save Generator button


Step 19 - Go to the username Attribute's Generator

  • In the Domains Attribute list panel, click on the username Attribute


Step 20 - Replace UsernameGen with ConcatGen

  • Click the RemoveGenerator button
  • Then, click the Yes button in the Confirmation dialog


Step 21 - Filter and Select the ConcatGen Generator

  • Enter, conc, in the filter input
  • Click ConcatGen or the + icon


  • You should see the following Generator Parameter Form
  • Now would be a good to to checkout the ConcatGen training video


Step 22 - Concatenate the Master.firstName Attribute

  • Double click the list parameter


Step 23 - Reference the Master.firstName Attribute

  • In the Domain Attributes tab, click the firstName link


Step 24 - Concatenate three more values

  • Add the following the three values to the list
    • add a period '.'
    • reference the Master.lastName Attribute
    • add, @example.com
  • Your result should look the Generator Parameter Form below.


Step 25 - Make the Concatenation All Lowercase

  • Set the caseType parameter to lowerCase
  • Click the Save Generator button


Move onto the next lesson >