Assign value

The Assign value masking activity allows you to assign a value of any type to a specified column of all table records.

Table of contents
Usage
Example
Properties

Usage

To use the Assign value 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 TValue 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. Next, enter the value you want to assign.

Select Types window Figure 1: Select Types window

While you can directly set a desired value, you can also use custom code to generate a value with a custom algorithm and data. Note that the Assign value masking activity remembers the first value it assigns to a record and assigns the same values to others, i.e. the value (or the custom code that determines the value) is evaluated only once. If you want to dynamically change the assigned value based on available data during package execution, use the Evaluate function masking activity instead.

Example

In this example we have the Amount column in the Transaction table where we want to mask the original amount. We only need the masked value to be in the correct format so our automatic testing process can use it, but we don't case about the actual masked value. We can achieve this by replacing everything in this column by an arbitrary value which will in this case be 100.00 since the column in question contains decimal values.

First we place the Transaction masking activity and put the Assign value masking activity within it. In the Select Types windows we choose Browse for Types... if decimal isn't suggested is not part of the list. In the Browse and Select a .Net Type window we find System.Decimal and choose it as the TValue. Once placed, we select the Amount property that we want to mask with our chosen value. Here, we will put 100.00M (the M is needed to mark the value as decimal) as the value we want to assign. We leave other properties as they are.

Assign value example Figure 2: Assigning values

Properties

Property group Property name Description Example
Input properties DataItemProperty The property to mask. Write x => x.Amount or choose property from the dropdown list
Value The value to use as a replacement value. 100.00M
Input: Filter Filter Expression used for filtering records - only filtered items will be masked. x => x.Amount != null
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. AmountRepeater
RepeatingKey Key to use for repeating detection. Write x => CompositeKey.Create(x.Amount) or choose properties from the pop-up window
Misc DisplayName Display name of the activity in the workflow. Assign value
Result Contains the masking definition object. It's a part of the masking infrastructure and should be ignored. -