Syntax for a range of data in a
named column
Description
A DataWindow data expression accesses values in a named column or
computed field for a range of rows when you specify the starting and
ending row numbers.
Syntax
|
1 |
dwcontrol.Object.columnname {.buffer } {.datasource } [ startrownum, endrownum ] |
|
Parameter |
Description |
|---|---|
|
dwcontrol |
The name of the DataWindow control or child |
|
columnname |
The name of a column or computed field in the |
|
buffer (optional) |
The name of the buffer from which you want to get
|
|
datasource (optional) |
The source of the data. Values
|
|
startrownum |
The number of the first row in the desired range of |
|
endrownum |
The number of the last row in the desired range of The row numbers must be enclosed in brackets |
Return value
The datatype of the expression is Any. The expression returns an
array of values with an array element for each row in the range. Each
value’s datatype is the datatype of columnname.
Usage
When you specify a range, the expression always returns an array
and you must assign the result to an array, even if you know there is
only one value in the result. For example, this expression returns an
array of one value:
|
1 |
dw_1.Object.empname[22,22] |
Examples
Because the primary buffer and current data are the default, these
expressions are all equivalent:
|
1 2 3 4 |
dw_1.Object.emp_name[11,20] dw_1.Object.emp_name.Primary[11,20] dw_1.Object.emp_name.Current[11,20] dw_1.Object.emp_name.Primary.Current[11,20] |
This example resets the emp_name value in rows 11 through 20 to an
empty string. Rows 12 to 20 are set to a default value, which may be an
empty string:
|
1 2 3 4 |
string ls_empty[] ls_empty[1] = "" dw_1.Object.emp_name[11,20] = & {"","","","","","","","","",""} |
This statement gets the original emp_name values in rows 11 to 20
and assigns them to elements 1 to 10 in an array of strings:
|
1 2 |
string ls_namearray[] ls_namearray = dw_1.Object.emp_name.Original[11,20] |
This statement gets current values of emp_name from rows 5 to 8 in
the Filter buffer and assigns them to elements 1 to 4 in an array of
strings:
|
1 2 |
string ls_namearray[] ls_namearray = dw_1.Object.emp_name.Filter[5,8] |
This statement gets original values of emp_name instead of current
values, as shown in the previous example:
|
1 2 3 |
string ls_namearray[] ls_namearray = & dw_1.Object.emp_name.Filter.Original[5,8] |
This statement gets current values of emp_name from rows 50 to 200
in the delete buffer and assigns them to elements 1 to 151 in an array
of strings:
|
1 2 |
string ls_namearray[] ls_namearray = dw_1.Object.emp_name.Delete[50,200] |
This statement gets original values of emp_name instead of current
values, as shown in the previous example:
|
1 2 3 |
string ls_namearray[] ls_namearray = & dw_1.Object.emp_name.Delete.Original[50,200] |