Syntax for all data from selected rows

Description

A DataWindow data expression accesses all the data in the currently selected rows when you specify the Data and Selected properties. Selected rows are always in the primary buffer.

Syntax

dwcontrol.Object.Data {.Primary } {.datasource }.Selected

Parameter

Description

dwcontrol

The name of the DataWindow control or child DataWindow in which you want to get or set data.

datasource

(optional)

The source of the data. Values are:

  • Current -- (Default) The current values in the DataWindow control.

  • Original -- The values that were initially retrieved from the database.


Return values

The datatype of the expression is Any. The expression returns an array of structures or user objects. There is one structure element or instance variable for each column in the DataWindow object. The datatype of each element matches the datatype of the corresponding column.

Usage

When you specify selected rows, 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.

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 data in the selected rows:

dw_1.Object.Data.Selected
dw_1.Object.Data.Primary.Selected
dw_1.Object.Data.Current.Selected
dw_1.Object.Data.Primary.Current.Selected

Both these expressions access original values for selected rows:

dw_1.Object.Data.Original.Selected
dw_1.Object.Data.Primary.Original.Selected

This example takes the values in the selected rows in dw_2 and populates a DropDownDataWindow in dw_1 with the values, replacing existing data in the DropDownDataWindow. The column with the DropDownDataWindow is called useroptions. The columns of the DataWindow object in dw_2 must match the columns of the DataWindow object for the DropDownDataWindow:

dw_1.Object.useroptions.Object.Data = &
      dw_2.Object.Data.Selected