Evaluate function

The Evaluate function masking activity allows you to assign values of any type to the specified record column.

Table of contents
Usage
Example
Properties

Usage

To use the Evaluate function 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 and enter a lambda expression that results in a value of the chosen type you want to assign to that property. Expressions must be valid expressions resulting in values of the chosen type.

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 Evaluate function masking activity always evaluates the expression, i.e. the value (or the custom code that determines the value) is generated for each record. If you want to assign the same value to all records, use the Assign value masking activity instead. Additionally, the lambda expression gives you access to the record you are currently masking which allows you to use its values to determine the masked value.

Example

In this example we want to mask the Amount column in the Transaction table. We don't need a complicated masking, so merely increasing the value by a random amount will suffice. One way to do this is by creating a custom method that we will use with the Evaluate function masking activity.

First we place the Transaction masking activity and put the Evaluate function 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 new value.

In order to achieve the desired results, we can write some custom code to create a new, masked transaction amount. The code looks like this:

public static class Code
{
    private static Random r = new Random();
    public static decimal GetRandomAmount(decimal amount)
    {
        return amount + r.Next(0, 999);
    }
}

The GetRandomAmount(decimal amount) method returns a new, masked transaction amount. We can then use this method in our lambda expression and pass the record (represented in the lambda expression as record) to our method. The lambda expression looks like this: record => Code.GetRandomAmount(record.Amount). We leave other properties as they are.

Evaluate function example Figure 2: Evaluating and 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
Func The function to use to get the replacement value. record => Code.GetReplacementValue()
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. Evaluate function
Result Contains the masking definition object. It's a part of the masking infrastructure and should be ignored. -