Show / Hide Table of Contents

    DataStoreExtensions.ExportJson(bool primarydata, bool filterdata, bool deletedata, bool dwcdata, bool format = false) Method

    .NET Standard 2.x

    Exports data from the specified buffer(s) and/or DataWindowChild to a plain JSON string or DataWindow JSON string.

    Namespace: PowerScript.Bridge

    Assembly: PowerScript.Bridge.dll

    Syntax

    public static string ExportJson(this IDataStoreBase dataStore, bool primarydata, bool filterdata, bool deletedata, bool dwcdata, bool format = false)
    

    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

    A boolean specifying whether to export the DataWindowChild data.

    True -- to export. If it is to export the DataWindowChild data, data from all buffers will be exported to a plain JSON, regardless of the value of the other arguments.

    False -- not to export.

    format System.Boolean

    A boolean specifying the JSON format.

    True indicates the DataWindow JSON.

    False indicates the plain JSON. The default is false.

    Returns

    System.String

    Returns the JSON string if it succeeds.

    Examples

    The following code example demonstrates how to export the course records (including DataWindowChild) to JSON strings. The "d_course" DataWindow object has a departmentid column which embeds a child DataWindow "dddw_deparment".

    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 Example2()
            {
                // Instantiates the datastore with datawindow: d_course
                var datastore = new DataStore("d_course", _context);
    
                datastore.Retrieve();
    
                // Exports all buffers including data of child DataWindow.
                // Exports to a DataWindow JSON string.
                string json = datastore.ExportJson(true, true, true, true, true);
    
                Console.WriteLine(json);
    
                /*The exported JSON file is:
    
                ExportJson2.json  
                */
            }
        }
    }
    

    Example Refer To

    Model Classes: D_Course Dddw_Department
    JSON File: ExportJson2
    DataWindow File: d_course

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon