IDwDataExporter.Export(int startRow, int endRow, bool colheading = true) Method
.NET Standard 2.x
Exports data from the DataStore primary buffer in the specified DataFormat
, and specifies the start and end positions of the rows, and whether to include columns heading.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
string Export(int startRow, int endRow, bool colheading = true)
Parameters
startRow
System.Int32
The zero-based index number of the first row in the buffer that you want to export.
endRow
System.Int32
The zero-based index number of the last row in the buffer that you want to export.
If it is negative, it indicates the rest of rows.
colheading
System.Boolean
Specify whether the exported data contains column heading.
Returns
System.String
Data string in the specified format.
Reference DataWindow JSON Plain JSON
Examples
The following code example demonstrates how to export the first department record to a JSON string without column headings.
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 Example2()
{
// 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);
string json = exporter.Export(0, 0, false);
Console.WriteLine(json);
/*This code produces the following output:
[{"Departmentid":1,"Name":"Engineering","Budget":220000.0000,"Startdate":"2007-09-01T00:00:00","Administrator":2}]
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department