Generate and convert to text

The Generate and convert to text masking activity allows you to generate a value using an IGenerator implementation and convert it to text, i.e. a string value, before saving it to the database.

It functions the same as the Generate and convert, if you choose String as the output value.

Table of contents
Usage
Example
Properties

Usage

To use the Generate and convert to text masking activity, it must be placed inside a table masking activity or a similar activity that iterates over data. Once placed, a Select Types window will open where you must choose the TGeneratedValue type, i.e. the type you want to generate. Selecting the Browse for Types... option will open the Browse and Select a .Net Type window where you can search for more types. After clicking OK, you can choose the property you want to mask, and then enter an instance of a generator you want to you to generate new values. You can create a new instance as a part of the masking activity, or you can choose an instance from custom code. Lastly, you have to enter an expression that will convert you generated value to string.

Example

Let's assume we want to randomly generate an account number. The type of the Number column in the Account table is varchar, so we have to convert the value to a string before we can save the record. We do this by first placing the Account masking activity into opened Package.xaml, placing the Generate and convert to text masking activity inside it. In the Select Types windows we choose Int32 as the TGeneratedValue.

Select Types window Figure 1: Select Types window

After selecting the value type, we choose the Number column. As the generator, we create a new instance of the RandomNumberGenerator, and set it to generate values between 1 and 100. We then need to create an expression that will convert the generated number to a string.

Generate and convert to text example Figure 2: Generating and converting values to text

Note: Generally, convertors are defined through lambda expressions. To learn more about lambda expressions see lambda expressions.

Properties

Property group Property name Description Example
Input properties DataItemProperty The property to mask. Write x => x.Number or choose property from the dropdown list
Expression Expression used to convert generated values. x => x.ToString()
Generator Generator used to generate values. new RandomNumberGenerator(1, 100)
Input: Filter Filter Expression used for filtering records - only filtered items will be masked. x => x.Number.StartsWith("0")
SkipDefaultValues If true, default values will be omitted in masking (i.e. null values are not masked). true or false
Input: Repeating RepeaterId The ID of the repeater that will be used to detect repeating and save results when masking item key repeats. GenerateAndConvertToTextRepeater
RepeatingKey Key to use for repeating detection. Write x => CompositeKey.Create(x.Number) or choose properties from the pop-up window
Misc DisplayName Display name of the activity in the workflow. Generate and convert to text
Result Contains the masking definition object. It's a part of the masking infrastructure and should be ignored. -