Techniques for accessing data
Two techniques
There are two ways to access data values in a DataWindow control:
-
Methods
SetItem and the group of GetItem methods
access single values in specific rows and columns. For example:1dw_1.SetItem(1, "empname", "Phillips")1ls_name = dw_1.GetItemString(1, "empname") -
Expressions
DataWindow data expressions use dot notation and can refer
to single items, columns, blocks of data, selected data, or the
whole DataWindow control. For example:1dw_1.Object.empname[1] = "Phillips"1dw_1.Object.Data[1,1] = "Phillips"
Both methods allow you to access data in any buffer and to
get original or current values.
Which technique to use
The technique you use depends on how much data you are accessing
and whether you know the names of the DataWindow columns when the
script is compiled:
|
If you |
Use |
|---|---|
|
A single item |
Either an expression or a method. Both Exception
If you want to use a column’s name rather than its |
|
More than one item, such as:
|
An expression. Specifying the data you |
What’s in this section
The rest of this section describes how to construct expressions
for accessing DataWindow data. The section “Syntaxes for DataWindow
data expressions “ provides reference
information on the syntaxes for data expressions.
For information on methods
For information about using methods for accessing data, see SetItem, GetItemDate, GetItemDateTime, GetItemDecimal, GetItemNumber, GetItemString, and GetItemTime in Chapter 9, “Methods for the DataWindow Control.”