IDataStore.GetItemNumber(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) Method
.NET Standard 2.x
Gets data whose type is Double
for the specified row and column from the specified buffer of the DataStore. You can obtain the data that was originally retrieved and stored in the database, as well as the current value in the primary, delete, or filter buffers.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public double? GetItemNumber(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false);
Parameters
row
System.Int32
The zero-based row number to get data.
column
System.String
The name of a column to get data.
To get the contents of a computed field, specify the name of the computed field for column. Computed fields do not have numbers.
bufferType
DWNet.Data.DwBuffer
The specified buffer of the DataStore.
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
System.Double?
Returns the numeric value (decimal
, double
, short
, int
or float
) in the specified row and column.
Remarks
Use GetItemNumber
when you want to get information from the DataWindow buffer
. To access a row in the original buffer, specify the buffer that the row currently occupies (primary, delete, or filter) and the number of the row in that buffer. When you specify true
for isOriginalValue
, the method gets the original data for that row.
Examples
The following code example demonstrates how to use the GetItemNumber
method to get the integer-type value in the specified row and column.
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreExamples
{
public class GetItemNumberExample
{
private readonly SchoolContext _context;
public GetItemNumberExample(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();
// Sets the "departmentid" column in the first row to "100".
datastore.SetItem(0, "departmentid", 100);
// Gets the original value in the first row and in the departmentid column and
// name column of DataStore.
// The departmentid column is int type.
Console.WriteLine(
"Original value: Department ID: {0}; Department Name: {1}",
datastore.GetItemNumber(0, "departmentid", DwBuffer.Primary, true),
datastore.GetItem(0, "name"));
// Gets the modified value in the first row and in the departmentid column and
// name column of DataStore.
// The departmentid column is int type.
Console.WriteLine(
"Modified value: Department ID: {0}; Department Name: {1}",
datastore.GetItemNumber(0, "departmentid", DwBuffer.Primary, false),
datastore.GetItem(0, "name"));
/*This code produces the following output:
Original value: Department ID: 1; Department Name: Engineering
Modified value: Department ID: 100; Department Name: Engineering
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x