Show / Hide Table of Contents

    IDwDataExporter.Export(bool primaryData, bool filterData, bool deleteData, bool dwcdata, MappingMethod importMapping) Method

    .NET Standard 2.x

    Exports data(DataWindowChild) from the specified buffer of the DataStore in the specified DataFormat, and how to map columns.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

    string Export(bool primaryData, bool filterData, bool deleteData, bool dwcdata, MappingMethod importMapping);
    

    Parameters

    primaryData System.Boolean

    A boolean specifying whether to export the data from the primary buffer.

    True: to export.

    False: not to export.

    filterData System.Boolean

    A boolean specifying whether to export the data from the filter buffer.

    True: to export.

    False: not to export.

    deleteData System.Boolean

    A boolean specifying whether to export the data from the delete buffer.

    True: to export.

    False: not to export.

    dwcData System.Boolean

    Aboolean specifying whether to export the DataWindowChild data.

    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 course records (including DataWindowChild) to JSON strings. When primaryData is true, exports data from the primary buffer to the JSON string; When filterData is true, exports data from the filter buffer to the JSON string; When deleteData is true, exports data from the delete buffer to the JSON string; When dwcdata is true, exports data from the DataWindowChild to the JSON string. The "d_course" DataWindow object has a departmentid column which embeds a child DataWindow "dddw_deparment".

    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 Example7()
            {
                // Instantiates the datastore with datawindow: d_course
                var datastore = new DataStore("d_course", _context);
    
                // Generates data in primary/delete/filter buffers for this example
                datastore.Retrieve();
                datastore.DeleteRow(0);
                datastore.SetFilter("departmentid < 5");
                datastore.Filter();
    
                // Get DataStore exporter in JSON format.
                var exporter = datastore.GetDataExporter(DataFormat.Json);
    
                // Exports all buffers including data of child DataWindow.
                string json1 = exporter.Export(true, true, true, true, 0);
    
                Console.WriteLine("exporter.Export(true, true, true, true, 0):");
                Console.WriteLine(json1);
    
                /*The exported JSON file is:
    
                ExportJson4_1.json  
                */
    
                // Exports all buffers without data of child DataWindow.
                string json2 = exporter.Export(true, true, true, false, 0);
    
                Console.WriteLine("exporter.Export(true, true, true, false, 0):");
                Console.WriteLine(json2);
    
                /*The exported JSON file is:
    
                ExportJson4_2.json  
                */
            }
        }
    }
    

    Example Refer To

    Model Classes: D_Course Dddw_Department
    JSON Files: ExportJson4_1 ExportJson4_2
    DataWindow File: d_course

    Back to top Generated by Appeon