DataStoreExtensions.ExportJson(DwBuffer dwbuffer, bool changedonly, bool format) Method
.NET Standard 2.x
Exports all rows or only the changed rows from all or specified buffers to a plain JSON string or DataWindow JSON string.
Namespace: PowerScript.Bridge
Assembly: PowerScript.Bridge.dll
Syntax
public static string ExportJson(this IDataStoreBase dataStore, DwBuffer dwbuffer, bool changedonly, bool format)
Parameters
dwBuffer
DwNet.Data.DwBuffer
A value of the DwBuffer
enumerated datatype identifying the DataStore buffer from which you want to export the data.
changedonly
System.Boolean
A boolean specifying the changing flag.
True
-- to export the changed rows only (and all rows of the Delete buffer).
False
-- to export all rows.
format
System.Boolean
A boolean specifying the JSON format.
True
indicates the DataWindow JSON.
False
indicates the plain JSON.
Returns
System.String
Returns the JSON string if it succeeds.
Examples
The following code example exports the data from the primary buffer of DataStore to a DataWindow JSON string.
using System;
using DWNet.Data;
using PowerScript.Bridge;
namespace Appeon.ApiDoc.DataStoreExtensionsExamples
{
public class ExportJsonExample
{
private readonly SchoolContext _context;
public ExportJsonExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example3()
{
// Instantiates the datastore with datawindow: d_department
var datastore = new DataStore("d_department", _context);
datastore.Retrieve();
// Modifies the values at the first row
datastore.SetItem(0, 1, "department name");
// Exports the modified data from the primary buffer
// to the DataWindow JSON string.
string json = datastore.ExportJson(DwBuffer.Primary, true, true);
Console.WriteLine(json);
/*The exported JSON file is:
ExportJson3.json
*/
}
}
}
Example Refer To
Model Class: D_Department
JSON File: ExportJson3
DataWindow File: d_department
Applies to
.NET Standard
2.x