Support
How can we help you today?

Generate Meaningful Data Using Masks

The power of data generation with Datanamic Data Generator, lies in the fact you can generate data that is meaningful and that automatically matches your domain values. One way to generate meaningful data that matches your needs is to fill a field using the "Random text using mask" generator.

"Random Text Using Mask Fill Type

By using the "Random text using mask" fill type, you can generate strings that match a defined pattern. You can use the "random text using mask" generator with any data column that has a data type that accepts a string (char, varchar, clob, string, text, etc...) and user-defined types (domains) based on these string types.

To use the "Random text using mask" generator for a field, you must specify it in the Field settings pane. Select a column with a string data type and select generator "Random text using mask" in the fill type combobox in the Field settings pane. The second entry field in the Field settings pane is the "Mask" field. Here you can enter the pattern/mask. You can also select a predefined mask by clicking on the dropdown button (see below for information about predefined masks).

Figure 1: Select generator.

Defining a Mask

A mask is a text with any number of 'A', 'a', 'N' and '*' characters. During the data generation process the 'A' and 'a' characters will be replaced with a random letter. For 'A' upper case characters will be used and for 'a' lower case characters will be used. The '*' character will be replaced with a random letter from 'a' to 'Z' (mixed case). A 'N' character will be replaced with a random number from 0 to 9. '{n}' and '(n)' signs are used to repeat the last replace-action n times. You can also use constants in your mask. You define a constant by enclosing the text with '[' and ']' signs e.g. [this is a constant]. You can also make the generator randomly select one constant from a list of constants. In that case you must separate the constants (items) with a '|' sign e.g. [item1|item2|item3]. You can create quite complex masks by combining the signs above.

Mask options:

  • A: Random upper case alphabetical character
  • a: Random lower case alphabetical character
  • N: Random number (0-9)
  • *: Random number or upper case or lower case alphabetical character
  • {n} means iterate last sign 0 to max. n times.
  • (n) means iterate last sign 1 to n times.
  • [..] text between the brackets is seen as a constant
  • [item1|item2|item3] one item will be randomly selected and will be seen as a constant

Examples will clearify the various mask options:

Url:

[http:\\|https:\\|][www.]a(1)a{28}[.][com|nl|de|pl|be|co.uk|fr|org|net|ar]


E-mail address:
a(1)a{20}[.|_|]a{8}[@]a(1)a{20}[.|_|]a{8}[.][com|nl|de|pl|be|co.uk|fr|org|net]


Dutch zip code:
N(1)N(1)N(1)N(1)[ ]A(1)A(1)

Validating Masks

Before Datanamic Data Generator starts generating test data it will first validate all settings. The mask you defined will be validated also. It will for example validate whether data that will generated using the defined mask fits in the field. If less than 10% of the generated values are valid then it is recommended to change your mask. Datanamic Data Generator will give you a warning when that is the case.

Reusing Your Masks

When you want to use a mask in other Datanamic Data Generator projects as well, it might be useful to add your mask to the list of predefined masks.

You can find this list of predefined masks in the Options dialog (Tools | Options...). Predefined masks are listed in a memo field. Each line in this memo field represents a mask. You can add comments which will be ignored by the data generator using the '/*' and '*/' signs ("/* Dutch zip code */ N(1)N(1)N(1)N(1)[ ]A(1)A(1)"). The comments will help you identifying masks.

Masks added to the list of predefined masks will be added to the items that appear after clicking the dropdown button in the mask field on the Field settings pane. The list of predefined masks is stored in a text file (predefinedmasks.txt) in the Datanamic Data Generator application directory.



Resources

Learn Get products and technologies
  • Need to rough up some test data in a hurry? Generate your test data with Datanamic Data Generator trial software, available for download directly from Datanamic's download section.