A DataWindow data expression accesses values in a named column or computed field for a range of rows when you specify the starting and ending row numbers.
dwcontrol.Object.columnname {.buffer } {.datasource } [ startrownum, endrownum ]
Parameter |
Description |
---|---|
dwcontrol |
The name of the DataWindow control or child DataWindow in which you want to get or set data. |
columnname |
The name of a column or computed field in the DataWindow object in dwcontrol. If the column or computed field does not exist at runtime, an execution error occurs. |
buffer (optional) |
The name of the buffer from which you want to get or set data. Values are:
|
datasource (optional) |
The source of the data. Values are:
|
startrownum |
The number of the first row in the desired range of rows. |
endrownum |
The number of the last row in the desired range of rows. The row numbers must be enclosed in brackets and separated by commas. |
The datatype of the expression is Any. The expression returns an array of values with an array element for each row in the range. Each value’s datatype is the datatype of columnname.
When you specify a range, the expression always returns an array and you must assign the result to an array, even if you know there is only one value in the result. For example, this expression returns an array of one value:
dw_1.Object.empname[22,22]
Because the primary buffer and current data are the default, these expressions are all equivalent:
dw_1.Object.emp_name[11,20]
dw_1.Object.emp_name.Primary[11,20]
dw_1.Object.emp_name.Current[11,20]
dw_1.Object.emp_name.Primary.Current[11,20]
This example resets the emp_name value in rows 11 through 20 to an empty string. Rows 12 to 20 are set to a default value, which may be an empty string:
string ls_empty[]
ls_empty[1] = ""
dw_1.Object.emp_name[11,20] = & {"","","","","","","","","",""}
This statement gets the original emp_name values in rows 11 to 20 and assigns them to elements 1 to 10 in an array of strings:
string ls_namearray[]
ls_namearray = dw_1.Object.emp_name.Original[11,20]
This statement gets current values of emp_name from rows 5 to 8 in the Filter buffer and assigns them to elements 1 to 4 in an array of strings:
string ls_namearray[]
ls_namearray = dw_1.Object.emp_name.Filter[5,8]
This statement gets original values of emp_name instead of current values, as shown in the previous example:
string ls_namearray[]
ls_namearray = & dw_1.Object.emp_name.Filter.Original[5,8]
This statement gets current values of emp_name from rows 50 to 200 in the delete buffer and assigns them to elements 1 to 151 in an array of strings:
string ls_namearray[]
ls_namearray = dw_1.Object.emp_name.Delete[50,200]
This statement gets original values of emp_name instead of current values, as shown in the previous example:
string ls_namearray[]
ls_namearray = &
dw_1.Object.emp_name.Delete.Original[50,200]