Syntax for
selected data in a named column
Description
A DataWindow data expression uses the Selected property to access
values in a named column or computed field for the currently selected
rows. Selected data is always in the primary buffer.
Syntax
|
1 |
dwcontrol.Object.columnname {.Primary } {.datasource }.Selected |
|
Parameter |
Description |
|---|---|
|
dwcontrol |
The name of the DataWindow control or child |
|
columnname |
The name of a column or computed field in the |
|
datasource (optional) |
The source of the data. Values
|
Return value
The datatype of the expression is Any. The expression returns an
array of values with the datatype of columnname.
Usage
When you specify selected values, the expression always returns an
array and you must assign the result to an array, even if you know there
is only one row selected.
For selected rows, the primary buffer is the only applicable
buffer. For consistency, you can include Primary in this syntax but it
is not necessary.
Examples
Because the primary buffer is the only applicable buffer for
selected data and current data is the default, these expressions are all
equivalent. They access values in the emp_name column for selected
rows:
|
1 2 3 4 |
dw_1.Object.emp_name.Selected dw_1.Object.emp_name.Primary.Selected dw_1.Object.emp_name.Current.Selected dw_1.Object.emp_name.Primary.Current.Selected |
These expressions both access original values for selected
rows:
|
1 2 |
dw_1.Object.emp_name.Original.Selected dw_1.Object.emp_name.Primary.Original.Selected |
This example sets the emp_name value in the first selected row to
an empty string. The rest of the selected rows are set to a default
value, which can be an empty string:
|
1 2 3 |
string ls_empty[] ls_empty[1] = "" dw_1.Object.emp_lname.Selected = ls_empty |
This statement gets the original emp_name values in selected rows
and assigns them to an array of strings:
|
1 2 |
string ls_namearray[] ls_namearray = dw_1.Object.emp_name.Original.Selected |