# TransformResult

## TransformationResult

This class represents the result of a data transformation process, encapsulating various properties and methods needed to handle transformed data, quality validation results, transformation report, and other related information.

## Methods

### AsJson

Returns the result table as JSON.

**Example:**

```csharp
string jsonResult = transformationResult.AsJson();
```

### AsCompressedBytes

Returns the result table as a compressed byte object.

**Example:**

```csharp
byte[] compressedResult = transformationResult.AsCompressedBytes();
```

### GetCSVNameOfExportFile

Gets the filename from the map, calls `MappingSpecification.GetCSVName`.

**Example:**

```csharp
string csvFileName = transformationResult.GetCSVNameOfExportFile();
```

### GetXLSXNameOfExportFile

Gets the filename from the map, calls `MappingSpecification.GetXLSXName`.

**Example:**

```csharp
string xlsxFileName = transformationResult.GetXLSXNameOfExportFile();
```

### GetJSONNameOfExportFile

Gets the filename from the map, calls `MappingSpecification.GetJSONName`.

**Example:**

```csharp
string jsonFileName = transformationResult.GetJSONNameOfExportFile();
```

### LookupsToTable

Converts the lookup maps back into a DataTable.

**Example:**

```csharp
DataTable lookupsTable = transformationResult.LookupsToTable();
```

### GetMissingMapsTable

Generates a table for the missing maps information.

**Example:**

```csharp
DataTable missingMapsTable = transformationResult.GetMissingMapsTable();
```

### Yardi\_SegmentValidation

Runs segment validation, adding the results to `DataQualityResults`.

**Parameters:**

* `path` (string): Path to import.

**Example:**

```csharp
transformationResult = transformationResult.Yardi_SegmentValidation("path/to/file");
```

### Yardi\_SegmentValidation

Runs segment validation, adding the results to `DataQualityResults`.

**Parameters:**

* `Segments` (List\<SegmentValidation.SegmentRaw>): List of raw segments.

**Example:**

```csharp
List<SegmentValidation.SegmentRaw> segments = new List<SegmentValidation.SegmentRaw>();
transformationResult = transformationResult.Yardi_SegmentValidation(segments);
```

### Yardi\_SegmentValidation

Runs segment validation, adding the results to `DataQualityResults`.

**Parameters:**

* `Segments` (byte\[]): Byte array of compressed segments.

{% hint style="info" %}
You can serialize and de-serialize segments with:

* `SegmentValidation.SegmentRaw.DeserializeArray(bytes)`
* `SegmentValidation.SegmentRaw.SerializeArray(segments)`
  {% endhint %}

**Example:**

```csharp
byte[] segments = new byte[0];
transformationResult = transformationResult.Yardi_SegmentValidation(segments);
```

### WriteCSV

Writes the CSV file for the transformed file and appends the results to the transformation report.

**Example:**

```csharp
byte[] csv = transformationResult.WriteCSV();
```

### WriteXLSX

Writes the XLSX file for the transformed file.

**Parameters:**

* `topColor` (XLColor, optional): XL top band color if any header rows are added.
* `headerRows` (int, optional): Number of header rows.
* `headerImageFile` (byte\[], optional): If provided, an image will be added at the top within the header rows.

**Example:**

```csharp
byte[] xlsx = transformationResult.WriteXLSX();
```

### WriteJSON

Writes the JSON file for the transformed file.

**Parameters:**

* `formatting` (Newtonsoft.Json.Formatting, optional): JSON formatting.

**Example:**

```csharp
byte[] json = transformationResult.WriteJSON();
```

### GenerateTransformationReport

Generates the tables needed for a transformation report.

**Example:**

```csharp
List<DataTable> transformationReportTables = transformationResult.GenerateTransformationReport();
```

### GenerateDataQualityReport

Generates the tables needed for a data quality report.

**Example:**

```csharp
List<DataTable> dataQualityReportTables = transformationResult.GenerateDataQualityReport();
```

### ToZippedResults

Produces a zip of the results of the transformation.

**Parameters:**

* `includeMap` (bool, optional): Includes mapping file.
* `includeTransformed` (bool, optional): Includes transformed file.
* `includeTransformReport` (bool, optional): Includes transform report.
* `includeDQReport` (bool, optional): Includes DataQualityReport.
* `includeMissingMaps` (bool, optional): Includes missing maps, if any.
* `IncludeLookupMaps` (bool, optional): Includes used lookupValueMaps.
* `rptLogoPath` (string, optional): If supplied, used as the branded logo header for reports.
* `rptHeaderRows` (int, optional): Number of header rows to append.
* `rptTopColor` (XLColor, optional): Header row solid color fill.
* `inputFileBytes` (byte\[], optional): Original file will also be included in the zip if supplied.
* `inputFileName` (string, optional): Original file name if supplied.
* `format` (CleanFileFormat, optional): Sets the file format of the transformed file.

**Example:**

```csharp
byte[] zippedResults = transformationResult.ToZippedResults();
```

### ToZippedResults\_Branding

Produces a zip of the results of the transformation with branding information from a byte array.

**Parameters:**

* `includeMap` (bool, optional): Includes mapping file.
* `includeTransformed` (bool, optional): Includes transformed file.
* `includeTransformReport` (bool, optional): Includes transform report.
* `includeDQReport` (bool, optional): Includes DataQualityReport.
* `includeMissingMaps` (bool, optional): Includes missing maps, if any.
* `IncludeLookupMaps` (bool, optional): Includes used lookupValueMaps.
* `rptLogo` (byte\[], optional): If supplied, used as the branded logo header for reports.
* `rptHeaderRows` (int, optional): Number of header rows to append.
* `rptTopColor` (XLColor, optional): Header row solid color fill.
* `inputFileBytes` (byte\[], optional): Original file will also be included in the zip if supplied.
* `inputFileName` (string, optional): Original file name if supplied.
* `format` (CleanFileFormat, optional): Sets the file format of the transformed file.

**Example:**

```csharp
byte[] zippedResultsWithBranding = transformationResult.ToZippedResults_Branding();
```

## Properties

### DataTableName

The data table name (Transformation Group).

### DataObjectID

A data object ID assigned from the map used.

### DataQualityResults

A list of data quality results.

### Report

The transformation report.

### TargetTable

The resulting target table.

### LookupMaps

Lookup maps used in process.

### map

The mapping specification used during the process.

### FileName

The filename, if supplied, of the source file.

### TransformationTime

The time the transformation took.

### HasMissingMaps

Indicates if there are missing maps.
