All about user defined generators

Applies to
ApexSQL Generate

Summary
This article provides answers to FAQs about the User defined generator in ApexSQL Generate.

Content:

Q: What is the User defined generator?

A: A User defined generator is test data generation feature of ApexSQL Generate that allows the user to set and configure desired generator options, name and save the generator for later use

Q: What are the benefits of using it?

A: Instead of re-setting the same settings repeatedly, a User defined allows any generator to be saved and reused when needed again.

Q: Which options are available for User defined after it’s saved?

A: The options and manner in which the values are generated, vary depending on which generator type is used as the basis for the User defined generator.

For example, if the Random generator for datetime data type is used as the basis for a User defined generator, the values will be generated in a seeded random manner and it will have the following options:

If the Incremental generator for smallint data type is used as the basis for a User defined generator, the main set of options will, again, be exact the same as in the regular Incremental generator. Unlike the Random generator, it won’t have the Seed value option, as in the Incremental generator the generating sequence is defined with the Increment option.

Q: How can I create a User defined generator?

A: In order to save a generator as User defined, click the Save button next to the Generator drop-down list, after specifying the desired configuration options:

Once clicked, the Save generator dialog will open. Specify generator name and confirm save on OK:

Q: How can I reuse my user defined generator once it’s saved?

A: Once the user defined generator is saved, it can be reused by selecting User defined, which will appear as an option for generator selection, in the Generator drop-down list:

After selecting the User defined generator’s option, all previously saved generators will be available from the Name drop-down list:

Q: Where are these generators being saved and can I change the location?

A: The generator will be saved in the User defined folder, in My Documents\ApexSQL\ApexSQL Generate, by default. This folder is created in the application installation process, but it can be changed by simply providing a path to a new directory in Options>Database>The User defined folder option:


Q: Can I save a user defined generator in more than one directory at once?

A: Generators can be saved in additional directories. For example, it can be saved in the Dropbox folder so it can be shared and used on another machine.

In order to save the generator in additional directory, the “Share” option must be checked. On this action the Save generator form will expand:

Once expanded, a field with a path to a user defined folder will preview. This is a default setup and directories for additional saves can be chosen by clicking the Browse button marked in the screenshot above. This way, multiple saving locations can be set for a single generator:

Q: How do I load a user defined generator that someone shared with me?

A: If saved generator is located in any other folder but the one is specified as user defined in the Options, it will not present itself in the Name drop-down list. Instead, it should be browsed for by clicking the Browse button in the generator’s settings:

Once the generator is selected and loaded, it will look just the same as it was selected from the drop-down list.

Q: How can I delete saved user defined generator?

A: User defined generators can be deleted from the User defined generator’s settings by selecting the generator that needs to be removed and clicking the Delete button marked in the image bellow:

Q: What if I try to reuse the saved generator on a column with different data type than the one it’s originally saved on?

A: The application recognizes which data type a certain generator is saved on. Once the generator is saved, the User defined generator will appear as an option in the Generator drop-down list only for the columns with the matching data types as the one the generator is originally set on.

Q: Can I reuse a user defined generator on a same data type with a different length?

A: Yes, but only if it’s saved on a data type with shorter length and it’s being reused on a data type with bigger length. For example: a user defined generator set and saved on the column with nvarchar(50) data type can be reused on columns with nvarchar(255).