Evaluate numeric function

The Evaluate numeric function masking activity allows you to assign integer values to the specified record column.

Table of contents
Usage
Example
Properties

Usage

To use the Evaluate numeric function masking activity, it must be placed inside a table masking activity or a similar activity that iterates over data. Once placed, select the property you want to mask and enter a lambda expression that results in an integer value you want to assign to that property. Expressions must be valid expressions resulting in integer values.

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 numeric 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 number 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 CSC (Credit Card Security) number in the CreditCard table. We don't need realistic values from this column during testing, but we still need to change the original values. We can do this is by adding a random number to the original value. First we place the CreditCard masking activity and put the Evaluate numeric function masking activity within it. Once placed, we select the Csc property that we want to mask with our chosen date.

In order to achieve the desired results, we can write some custom code to create a random number between zero and one thousand and add it to the original CSC number. The code looks like this:

public static class Code
{
    private static Random r = new Random();
    public static int GetCscNumber(int originalCscNumber)
    {
        return originalCscNumber + r.Next(0, 999);
    }
}

The GetCscNumber(int originalCscNumber) method returns a new, masked CSC number. 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.GetCscNumber(record.Csc). We leave other properties as they are.

Evaluate numeric function example Figure 1: Evaluating and assigning integers

Properties

Property group Property name Description Example
Input properties DataItemProperty The property to mask. Write x => x.Csc 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.Csc.Length > 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. CscNumberRepeater
RepeatingKey Key to use for repeating detection. Write x => CompositeKey.Create(x.Csc) or choose properties from the pop-up window
Misc DisplayName Display name of the activity in the workflow. Evaluate numeric function
Result Contains the masking definition object. It's a part of the masking infrastructure and should be ignored. -