👋Quick Start Guide

Welcome to the documentation for the Transforms SDK. The goal is get you setup and running as quick as possible. Let's jump right in!

The Transformer is the primary class responsible for every single major operation that occurs in a transformation process. Let's review the steps and how these events occur.

Want to read a bit more about how the transforms system works?

Terminology

The Mapping Document

Steps

Retrieving the data

To transform data, we need data. Getting that data into the system is extremely easy using Transforms. Simply ask the Transformer to read a DataTable from the file. You can do this either by path, or by bytes.

//Direct read
DataTable file = Transformer.TableFromFile("Properties.csv");

//From a byte array and mime type
file = Transformer.TableFromFile(
    File.ReadAllBytes("Properties.csv"), 
    TransformUtil.ToMimeType("csv"), 
    "Properties.csv");

Retrieving associated files (maps, lookups, segments)

Before transforming the data, we need a map to process it through. We can simply ask the system the load this data in as well.

var maps = Transformer.GetMapFromFile("CommProperties.map.xlsx", out var rpt);

You can request lookups exactly the same way 👍

var lookups = Transformer.GetLookupFromFile("Lookups.lvm.xlsx", out var rpt);

Transforming

All transforming is done through the Transformer MapTo methods. They allow you take a DataTable , run it through a Map, and produce a target file.

TransformationResult Result = file.MapTo(maps.First());

Could it really be that easy? YES!.

This result object contains everything you need to produce reports and export data. Let's look at that next

Produce Data

Most of the time you'll be producing a data file to be inspected or loaded. There's an incredibly easy way to produce these results with an appropriately named file (using the mapping specification's export name)

File.WriteAllBytes(Result.GetCSVNameOfExportFile(), Result.WriteCSV());

If you're trying to write Excel, JSON or inspect the DataTable for the target result you can do so as well:

File.WriteAllBytes(Result.GetXLSXNameOfExportFile(), Result.WriteXLSX());
File.WriteAllBytes(Result.GetJSONNameOfExportFile(), Result.WriteJSON());
DataTable Target = Result.TargetTable;

Reporting

All reporting data is stored in structured classes. You may inspect, use or modify these however you see fit.

var transform_report = Result.Report;
var dq_report = Result.DataQualityResults

If you would like to generate DataTables from these reports, there are built in commands to do so:

var DT_TransformReport = Result.GenerateTransformationReport();
var DT_DQ = Result.GenerateDataQualityReport();

To produce XLSX reports from the reporting data, use the ExcelWriter by supplying the data, and optional header rows / images.

ExcelWriter.WriteWorkbook();
ExcelWriter.WriteWorkbookWithImageBytes();

Summary

This quick reference guide covers the entire process of importing data, mapping it, inspecting the results, and exporting data, including reports, out of the system. The following sections will provide more detailed instructions on how to customize and utilize other aspects of the transformation SDK.

Last updated