IDwDataExporter.Export(MappingMethod importMapping) Method
.NET Standard 2.x
Exports data from the DataStore primary buffer in the specified DataFormat
, and specifies how to map columns.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
string Export(MappingMethod importMapping);
Parameters
importMapping
SnapObjects.Data.MappingMethod
A value of the MappingMethod
enumerated datatype specifying the method for mapping columns.
Returns
System.String
Data string in the specified format.
Reference DataWindow JSON Plain JSON
Examples
The following code example demonstrates how to export the department records to a JSON string using different mapping methods.
using SnapObjects.Data;
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDwDataExporterExamples
{
public class ExportExample
{
private readonly SchoolContext _context;
public ExportExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example4()
{
// Instantiates a DataStore object with datawindow: d_department.
var datastore = new DataStore("d_department", _context);
datastore.Retrieve();
// Get DataStore exporter in JSON format.
var exporter = datastore.GetDataExporter(DataFormat.Json);
// Exports data from primary buffer to JSON string
// mapped by the JSON index
// mapping-method value in JSON is 0
string json1 = exporter.Export(MappingMethod.Index);
Console.WriteLine(json1);
/*The exported JSON file is:
ExportJson1_Index.json
*/
// Exports data from primary buffer to JSON string
// mapped by the JSON key
// mapping-method value in JSON is 2
string json2 = exporter.Export(MappingMethod.Key);
Console.WriteLine(json2);
/*The exported JSON file is:
ExportJson1_Key.json
*/
// Exports data from primary buffer to JSON string
// mapped by the column index
// mapping-method value in JSON is 1
string json3 = exporter.Export(MappingMethod.ColumnIndex);
Console.WriteLine(json3);
/*The exported JSON file is:
ExportJson1_ColumnIndex.json
*/
}
}
}
Example Refer To
Model Class: D_Department
JSON Files: ExportJson1_Index ExportJson1_Key ExportJson1_ColumnIndex
DataWindow File: d_department