Show / Hide Table of Contents

    DataStoreExtensions.GetValues<TValue>(string column, int startRow, int endRow, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) Method

    .NET Standard 2.x

    Gets the data from the specified column and from the specified ranges of rows.

    Namespace: PowerScript.Bridge

    Assembly: PowerScript.Bridge.dll

    Syntax

    public static TValue[] GetValues<TValue>(this IDataStoreBase dataStore, string column, int startRow, int endRow, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false);
    

    Parameters

    column System.String

    The zero-based column number to get data.

    startRow System.Int32

    The number of the first row you want to get. If it is a negative value, start getting data from the first row.

    endRow System.Int32

    The number of the last row you want to get. If it is a negative value, stop getting data after the last row.

    bufferType 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

    TValue[]

    Returns a TValue[] object which contains the data of the specified columns and rows.

    Examples

    The following code example demonstrates how to use the GetValues method to get the original values of the Name 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 GetValuesExample
        {
            private readonly SchoolContext _context;
    
            public GetValuesExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example2()
            {
                // Instantiates a DataStore object with datawindow: d_department.
                var datastore = new DataStore("d_department", _context);
    
                datastore.Retrieve();
                // Modifies the data values in the first row.
                datastore.SetItem(0, 1, "department name");
    
                // Gets the original values of Name column in 1st and 2nd rows in DataStore primary buffer.
                var names = datastore.GetValues<string>("Name",0, 1, DwBuffer.Primary, true);
    
                Console.WriteLine($"names Length={names.Length}, names[0]={names[0]}");
    
                /*This code produces the following output:
                
                names Length=2, names[0]=Engineering            
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon