Generate date

The Generate date masking activity allows you to generate a random date based on a base date with specific offset values.

Table of contents
Usage
Example
Properties

Usage

To use the Generate date 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. Generating a date requires a base date that will be used to generate new dates. Clicking on the ... opens the *DateTime Source Selector window.

DateTime Source Selector window Figure 1: DateTime Source Selector window

Here you can select the base date as the Property base value or an Absolute value that you set yourself. If you choose to you the absolute value, the format must be a valid DateTime format.

After you select the desired base date, you must enter the offset values. These dictate the range in which the random date will be chosen in regards with base date. These have to be TimeSpan instances. Note that you can use offset values to generate dates before the base date by providing the appropriate values.

Additionaly, you can set the DateOnly property to control whether only the date part of the base date should be changed, or if other properties (e.g. time values) should be changed as well.

Example

In this example we want to generate dates for the expiration date column in the CreditCard table so that every generated value is in the year 2020. First we place the CreditCard masking activity into opened Package.xaml and put the Generate date masking activity within it. Once placed, we select the ExpirationDate property that we want to mask with generated dates. Here, we will put 01/01/2020 as the base date. For the offsets, we put a new TimeSpan instance without any additional values as the minimal offset and an offset of 365 days in the maximum offset. This will ensure that every generated date will be in the year 2020. We leave other properties as they are.

Generating dates Figure 2: Generating dates

Properties

Property group Property name Description Example
Input properties AbsoluteBase Absolute base date used for generation. Cannot be used with PropertyBase. 1.1.2020.
DataItemProperty The property to mask. Write x => x.ExpirationDate or choose property from the dropdown list
DateOnly Whether the generator should produce only dates, without time. true or false
Max Time difference maximum. new TimeSpan()
Min Time difference minimum. new TimeSpan(365, 0, 0, 0)
PropertyBase Property base date used for generation. Cannot be used with AbsoluteBase. x => x.ExpirationDate
Input: Filter Filter Expression used for filtering records - only filtered items will be masked. x => x.ExpirationDate.DayOfWeek == DayOfWeek.Monday
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. GenerateDateRepeater
RepeatingKey Key to use for repeating detection. Write x => CompositeKey.Create(x.ExpirationDate) or choose properties from the pop-up window
Misc DisplayName Display name of the activity in the workflow. Generate date
Result Contains the masking definition object. It's a part of the masking infrastructure and should be ignored. -