Show / Hide Table of Contents

    DataStoreExtensions.SetBlock(this IDataStoreBase dataStore, int startRow, short startColumn, int endRow, short endColumn, object value, DwBuffer bufferType = DwBuffer.Primary) Method

    .NET Standard 2.x

    Sets the data values for the specified range of rows and columns in DataStore.

    Namespace: PowerScript.Bridge

    Assembly: PowerScript.Bridge.dll

    Syntax

    public static void SetBlock(this IDataStoreBase dataStore, int startRow, short startColumn, int endRow, short endColumn, object value, DwBuffer bufferType = DwBuffer.Primary);
    

    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.

    value System.Object

    The values to be set.

    bufferType DwNet.Data.DwBuffer

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

    Examples

    The following code example demonstrates how to use the SetBlock method to set the values for the second column in the first and second rows in the primary buffer of DataStore.

    using System;
    using DWNet.Data;
    using PowerScript.Bridge;
    
    namespace Appeon.ApiDoc.DataStoreExtensionsExamples
    {
        public class SetBlockExample
        {
            private readonly SchoolContext _context;
    
            public SetBlockExample(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();
    
                string[] names = { "name1", "name2"};
    
                // Sets the values of 2nd column in 1st and 2nd rows in DataStore primary buffer 
                datastore.SetBlock(0, 1, 1, 1, names, DwBuffer.Primary);
    
                string name1 = datastore.GetItem<string>(0, 1);
                string name2 = datastore.GetItem<string>(1, 1);
    
                Console.WriteLine($"name1={name1}, name2={name2}");
    
                /*This code produces the following output:
                
                name1=name1, name2=name2            
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon