This walkthrough explains how to mask a CSV file by building a package that loads the given CSV file, performs masking and creates a new, masked CSV file.
Table of contents |
---|
Preconditions |
Masking activities that are going to be used |
Steps |
C:\Temp
From Solution Explorer open the Code.cs file.
In Code.cs add class Customer
with properties equal to the .csv headers.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizDataXPackage
{
/// <summary>
/// Contains custom code to be used during package execution.
/// </summary>
public static class Code
{
// TODO: Add your code here
}
public class Customer
{
public String FirstName { get; set; }
public String LastName { get; set; }
}
}
Save your changes and build the project.
First few rows of the CSV file that is going to be masked:
FirstName,LastName
Tabatha,Beard
Lukas,Warner
Jessika,Luna
Breanna,Hess
Malik,Strong
Hilary,Stark
Shelbi,Bond
Trinity,Rush
From the Solution Explorer open the Package.xaml file.
Delete the workflow created by default.
Drag the Step activity from the Toolbox into the opened Package.xaml.
Drag the Masking engine from the Toolbox into the Step.
Drag the Masking iterator from the Toolbox into the Masking engine.
In the Select Types pop-up window select Browse for Types...
and find Customer
.
Click OK on both pop-up windows.
Drag the API handler from the Toolbox into the Masking iterator, in the place that says "Drop data handler here".
In the API handler write
api=>api.Delimited().GetHandler<customer>("C:/Temp/Customers.csv","C:/Temp/Customers_masked.csv")
Drag the Pick US first name from list masking activity from the Toolbox into the Masking iterator, where it says "Drop activities here".
In the Pick US first name from list masking activity, select FirstName
as the "Property".
Do the same for the Pick US last name from list masking activity (select LastName
as "Property").
Save your changes and start package execution (Debug->Start Without Debugging).
Open the C:\Temp
directory to check for changes. A new file named customers_masked.csv is created and it contains masked data from the original customers.csv file.
FirstName,LastName
Freddy,Monroe
Allison,Ruiz
Chad,Franklin
Marisa,Riddle
Nolan,Carney
Jerrica,Flynn
Alejandro,Bray
Priscilla,Galloway
Figure 1: CSV file masking
Note: API Handler can be configured with additional options (custom delimiters, different encodings, etc):
Figure 2: API handler options
BizDataX Documentation © Built by Ekobit. All rights reserved.
https://www.ekobit.com/ https://bizdatax.com/ https://bizdatax.com/support/