The Evaluate text function masking activity allows you to assign string values to the specified record column.
Table of contents |
---|
Usage |
Example |
Properties |
To use the Evaluate text 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 string value you want to assign to that property. Expressions must be valid expressions resulting in string 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 text 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 text 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.
In this example we want to mask the Description column in the Transaction table. We want don't need realistic values, but we still want them to make sense with regard to the amount of money processed in the transaction. One way to do this is by creating a custom method that returns the value Bills if the amount is lower than 200, and return Salary otherwise. First we place the Transaction masking activity and put the Evaluate text function masking activity within it. Once placed, we select the Description 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 the correct transaction description with regards to the amount. The code looks like this:
public static class Code
{
public static string GetTransactionDescription(decimal amount)
{
return amount > 200 ? "Salary" : "Bills";
}
}
The GetTransactionDescription(decimal? amount) method returns a new, masked description. 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.GetTransactionDescription(record.Amount)
. We leave other properties as they are.
Figure 1: Evaluating and assigning text values
Property group | Property name | Description | Example |
---|---|---|---|
Input properties | DataItemProperty | The property to mask. | Write x => x.Description 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.Description.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. | DescriptionRepeater |
RepeatingKey | Key to use for repeating detection. | Write x => CompositeKey.Create(x.Description) or choose properties from the pop-up window |
|
Misc | DisplayName | Display name of the activity in the workflow. | Evaluate text function |
Result | Contains the masking definition object. It's a part of the masking infrastructure and should be ignored. | - |
BizDataX Documentation © Built by Ekobit. All rights reserved.
https://www.ekobit.com/ https://bizdatax.com/ https://bizdatax.com/support/