GET
Syntax
GET dst_any_var...FROM src_array_name(element) [field[(occurs)]]...
Description
Retrieves data from an array and places it into a date, string, or numeric variable.
Parameters
| Parameter | Description |
|---|---|
|
dst_any_var |
Date, string, or numeric variables (not database columns) can be destination variables. Numeric variables (decimal, float, integer) are copied from number fields. String variables are copied from the char, text, or date field. Date variables are copied from the char, text, or date field. When a date field is copied to a string variable, SQR converts the date to a string in the format specified by the SQR_DB_DATE_FORMAT setting. If this has not been set, SQR uses the first database-dependent format listed in the Default Database Formats table. If the destination is a date variable, the string extracted from the source must be in the format specified by the SQR_DB_DATE_FORMAT setting, or one of the database-dependent formats (see the Default Database Formats table), or the database-independent format 'SYYYYMMDD[HH24[MI[SS[NNNNNN]]]]'. |
|
src_array_name(element) |
If the array's field names are listed, SQR takes the values from the fields and occurrences specified. If the array's field names are not listed, the values are taken from consecutively defined fields in the array. |
|
field[(occurs)] |
Array element and field occurrence numbers can be numeric literals (such as 123) or numeric variables (such as #j). If no field occurrence is stated, occurrence zero is used. |
Example
The following code example copies $name, $start_date, and #salary from the first three fields in the #j th element of the emps array:
get $name $start_date #salary from emps(#j)
The following code example copies #city_tot and #county_tot from the fields cities and counties in the #j th element of the states array:
get #city_tot #county_tot from states(#j) cities counties
The following code example copies $code from the #j th occurrence of the code field in the #n th element of the codes array:
get $code from codes(#n) code(#j)
See The PUT command for information
about moving data into an array