About DataWindow data expressions

The Object property of the DataWindow control lets you specify expressions that refer directly to the data of the DataWindow object in the control. This direct data manipulation allows you to access small and large amounts of data in a single statement, without calling methods.

There are several variations of data expression syntax, divided into three groups. This section summarizes these syntaxes. The syntaxes are described in detail later in this chapter.

Data in columns or computed fields when you know the name

One or all items (if rownum is absent, include either buffer or datasource)

dwcontrol.Object.columnname {.buffer } {.datasource } { [ rownum ] }

Returns a single value (for a specific row number) or an array of values (when rownum is omitted) from the column.

See “Syntax for one or all data items in a named column”.

Selected items

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

Returns an array of values from the column with an array element for each selected row.

See “Syntax for selected data in a named column”.

Range of items

dwcontrol.Object.columnname {.buffer } {.datasource } [ startrownum, 
	endrownum ] 

Returns an array of values from the column with an array element for each row in the range.

See “Syntax for a range of data in a named column”.

Data in numbered columns

Single items

dwcontrol.Object.Data {.buffer } {.datasource } [ rownum, colnum ] 

Returns a single item whose datatype is the datatype of the column.

See “Syntax for a single data item in a DataWindow”.

Blocks of data involving a range of rows and columns

dwcontrol.Object.Data {.buffer } {.datasource } [ startrownum,
	startcolnum, endrownum, endcolnum ] 

Returns an array of structures or user objects. The structure elements match the columns in the range. There is one array element for each row in the range.

See “Syntax for data in a block of rows and columns”.

Whole rows

Single row or all rows

dwcontrol.Object.Data {.buffer } {.datasource } { [ rownum ] }

Returns one structure or user object (for a single row) or an array of them (for all rows). The structure elements match the columns in the DataWindow object.

See “Syntax for data in a single row or all rows”.

Selected rows

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

Returns an array of structures or user objects. The structure elements match the columns in the DataWindow object. There is one array element for each selected row.

See “Syntax for all data from selected rows”.

Summary of syntaxes

This diagram summarizes the variations in data expression syntax:

Figure 4-1: Variations in data expression syntax

This image is a branching diagram of data expression syntax. The first syntax element is always d w control dot Object. For a named column or computed field, this is followed by dot column name. For columns by number, more than one column, or whole rows, this is followed by dot data. Next, both syntax branches can include optional dot buffer and dot source arguments. Named columns or computed fields then branch off again. For one or all items, the final argument is an optional [ row ]. For selected items, it is dot Selected. For a range of items, it is [ row comma row ]. On the branch for columns by number, more than one column, or whole rows, the final argument for one item is [ row comma col ]. For a block of items it is [ row comma col comma row comma col ]. For one or all rows, it is the optional argument [ row ]. For selected rows, it is dot Selected.

For information about getting and setting values of DataWindow object properties using a similar syntax, see Chapter 5, “Accessing DataWindow Object Properties in Code.”