Show / Hide Table of Contents

    DataStoreExtensions.GetBlock<TModel>(this IDataStoreBase dataStore, int startRow, short startColumn, int endRow, short endColumn, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) Method

    .NET Standard 2.x

    Gets the data from the specified range of rows and columns from the specified buffer.

    Namespace: PowerScript.Bridge

    Assembly: PowerScript.Bridge.dll

    Syntax

    public static TModel[] GetBlock<TModel>(this IDataStoreBase dataStore, int startRow, short startColumn, int endRow, short endColumn, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false);
    

    Parameters

    startRow System.Int32

    The number of the first row in the desired range of rows.

    startColumn System.Int16

    The number for the first column in the range.

    endRow System.Int32

    The number of the last row in the range.

    endColumn System.Int16

    The number for the last column in the range.

    dwBuffer DwNet.Data.DwBuffer

    The specified buffer of the DataStore. The default is DwBuffer.Primary.

    isOriginalValue System.Boolean

    Whether to obtain the data that was originally retrieved.

    True: to obtain the data that was originally retrieved. False (default): to obtain the current data.

    Returns

    TModel[]

    Returns an array of TModel type.

    Examples

    The following code example demonstrates how to use the the GetBlock method to get the current values of the first and second rows in the primary buffer of DataStore.

    using System;
    using DWNet.Data;
    using Appeon.ApiDoc.Models;
    using PowerScript.Bridge;
    
    namespace Appeon.ApiDoc.DataStoreExtensionsExamples
    {
        public class GetBlockExample
        {
            private readonly SchoolContext _context;
    
            public GetBlockExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example()
            {
                // Instantiates a DataStore object with datawindow: d_department.
                var datastore = new DataStore("d_department", _context);
                datastore.Retrieve();
    
                // Modifies the data at the first row
                datastore.SetItem(0, 1, "department name");
    
                // Gets the current value of 1st and 2nd row in DataStore primary buffer.
                var models = datastore.GetBlock<D_Department>(0, 0, 1, -1, DwBuffer.Primary, false);
    
                Console.WriteLine($"models Length={models.Length}");
    
                /*This code produces the following output:
                
                models Length=2           
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon