Syntax for one or all data items
in a named column
Description
A DataWindow data expression can access a single item in a column
or computed field when you specify the control name and a row number. It
accesses all the data in the column when you omit the row number.
Syntax
|
1 |
dwcontrol.Object.columnname {.buffer } {.datasource } { [ rownum ] } |
|
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
|
|
rownum (optional) |
The row number of the desired item. The row number To access all the data When buffer or When rownum is omitted, |
Return value
The expression has a datatype of Any. The expression returns a
single value (for a specific row number) or an array of values (when
rownum is omitted). Each value has a datatype of columnname.
Usage
Is the expression a DWObject or
data?
When you want to access all the data in the column, remember to
specify at least one of the other optional parameters. Otherwise, the
expression you specify refers to the column control, not its data. This
expression refers to the DWObject empname, not the data in the
column:
|
1 |
dw_1.Object.empname |
In contrast, these expressions all refer to data in the empname
column:
|
1 2 |
dw_1.Object.empname.Primary // All rows dw_1.Object.empname[5] // Row 5 |
Row numbers for computed
fields
When you refer to a control in a band other than the detail band
(usually a computed field) you still specify a row number. For the
header, footer, or summary, specify a row number of 1. For the group
header or trailer, specify the group number:
|
1 |
dw_1.Object.avg_cf[1] |
If you specify nothing after the computed field name, you refer to
the computed field DWObject, not the data. For a computed field that
occurs more than once, you can get all values by specifying buffer or
datasource instead of rownum, just as for columns.
When the expression is an
array
When the expression returns an array (because there is no row
number), you must assign the result to an array, even if you know there
is only one row in the result.
This expression returns an array, even if there is only one row in
the DataWindow control:
|
1 |
dw_1.Object.empname.Primary |
This expression returns a single value:
|
1 |
dw_1.Object.empname[22] |
Examples
Because the default setting is current values in the primary
buffer, the following expressions are equivalent — both get the value
in row 1 for the emp_name column:
|
1 2 |
dw_1.Object.emp_name[1] dw_1.Object.emp_name.Primary.Current[1] |
This statement sets the emp_name value in row 1 to Wilson:
|
1 |
dw_1.Object.emp_name[1] = "Wilson" |
This statement gets values for all the emp_name values that have
been retrieved and assigns them to an array of strings:
|
1 2 |
string ls_namearray[] ls_namearray = dw_1.Object.emp_name.Current |
This statement gets current values of emp_name from all rows in
the filter buffer:
|
1 2 |
string ls_namearray[] ls_namearray = dw_1.Object.emp_name.Filter |
This statement gets original values of emp_name from all rows in
the filter buffer:
|
1 2 |
string ls_namearray[] ls_namearray = dw_1.Object.emp_name.Filter.Original |
This statement gets the current value of emp_name from row 14 in
the delete buffer:
|
1 2 |
string ls_name ls_name = dw_1.Object.emp_name.Delete[14] |
This statement gets the original value of emp_name from row 14 in
the delete buffer:
|
1 2 |
string ls_name ls_name = dw_1.Object.emp_name.Delete.Original[14] |
This statement gets all the values of the computed field
review_date:
|
1 2 |
string ld_review[] ld_review = dw_1.Object.review_date.Original |