Description
You can access a single item in a column or computed field by specifying the object name and a row number. You can access all the data in the column by omitting the row number.
Syntax
Return value
A single value (for a specific row number) or an array of values (when rownum is omitted). Each value's data type is the data type 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 object, not its data. This expression refers to the DWObject empname, not the data in the column:
dw_1.Object.empname
In contrast, this expressions all refer to data in the empname column:
dw_1.Object.empname.Primary // All rows
dw_1.Object.empname[5] // Row 5
Row numbers for computed fields When you refer to an object 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:
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:
dw_1.Object.empname.Primary
This expression returns a single value:
dw_1.Object.empname[22]
Examples
Because the default setting is current values in the primary buffer, the following expressions are equivalent梑oth get the value in row 1 for the emp_name column:
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:
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:
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:
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: