| Previous | Contents | Index |
ASK STRUCTURE struc_name, FIELD field_expr: NAME str_var
|
NAME returns the name of the specified field in a string variable.
ASK STRUCTURE struc_name, FIELD field_name: NULL int_var
|
If the specified field is NULL (i.e. contains no data), this statement returns TRUE. If the field is not NULL, the statement returns FALSE.
ASK STRUCTURE struc_name, FIELD field_expr: NUMBER num_var
|
NUMBER returns the field number of the specified field in a numeric variable. Fields are numbered sequentially. If the field does not exist, SheerPower returns a value of 0.
ASK STRUCTURE struc_name, FIELD field_expr: OPTIMIZED num_var
|
OPTIMIZED returns a value of TRUE or FALSE in a specified numeric variable. If the key field in field_expr is optimized, the value is TRUE. Otherwise, the value is FALSE.
| Example 15-30 OPTIMIZED - field definition item |
|---|
open structure cl: name 'sheerpower:samples\client' ask structure cl, field id: optimized z print z close structure cl end 1 |
ASK STRUCTURE struc_name, FIELD field_expr: POSITION num_var
|
POSITION returns the starting position for the specified field in a numeric variable.
ASK STRUCTURE struc_name, FIELD field_expr: PRINTMASK str_var
|
PRINTMASK returns the print mask for the specified field in a string variable.
ASK STRUCTURE struc_name, FIELD field_expr: PROMPT str_var
|
PROMPT returns the prompt for the specified field in a string variable.
ASK STRUCTURE struc_name, FIELD field_expr: SCREENMASK str_var
|
SCREENMASK returns the screen mask for the specified field in a string variable. This option is not currently used.
ASK STRUCTURE struc_name, FIELD field_expr: VRULES str_var
|
VRULES returns the validation rules for the specified field in a string variable.
Refer to the Section 6.6.6, VALID(text_str, rule_str) for information on validation rules.
| Example 15-31 VRULES - field definition item |
|---|
open structure cl : name 'sheerpower:samples\client' ask structure cl, field bday: vrules str$ print str$ end date ymd; minlength 8 |
ASK STRUCTURE struc_name: CURRENT str_var
|
| Example 15-32 ASK STRUCTURE: CURRENT |
|---|
dim a$(100)
let i = 0
open structure cl: name 'sheerpower:samples\client'
extract structure cl
end extract
for each cl
print cl(last); ', '; cl(first)
input 'Would you like to see this record (Y/N)': yn$
if yn$ = 'Y' then
let i = i + 1
ask structure cl: current a$(i)
end if
next cl
print
for j = 1 to i
set structure cl: current a$(j)
print cl(last); ','; cl(first), cl(state), cl(phone)
next j
end
Errant, Earl Would you like to see this record (Y/N)? Y
Abott, Al Would you like to see this record (Y/N)? Y
Brock, Bud Would you like to see this record (Y/N)? N
Cass, Cathy Would you like to see this record (Y/N)? N
Derringer, Dale Would you like to see this record (Y/N)? Y
Farmer, Fred Would you like to see this record (Y/N)? Y
Errant, Earl CA (408) 844-7676
Abott, Al NY (202) 566-9892
Derringer, Dale CA (818) 223-9014
Farmer, Fred FL (305) 552-7872
|
ASK STRUCTURE: CURRENT assigns the current record value to the str_var. Once the current record has been assigned with ASK STRUCTURE: CURRENT, the SET STRUCTURE: CURRENT statement can be used to get this record.
SheerPower returns a zero-length string if there is no CURRENT record.
15.8.3 ASK STRUCTURE: DATAFILE
ASK STRUCTURE struc_name: DATAFILE str_var
|
| Example 15-33 ASK STRUCTURE: DATAFILE |
|---|
open structure cust: name 'sheerpower:samples\customer' open structure cl: name 'sheerpower:samples\client' ask structure cust: datafile z1$ ask structure cl: datafile z2$ print z1$ print z2$ end C:\SHEERPOWER\samples\CUSTOMER.ARS C:\SHEERPOWER\samples\CLIENT.ARS |
The ASK STRUCTURE: DATAFILE statement returns the full file name/file specification of a specified structure. struc_name is the specified structure name. str_var contains the returned file specification.
ASK STRUCTURE struc_name: FIELDS num_var
|
| Example 15-34 ASK STRUCTURE: FIELDS |
|---|
open structure cl: name 'sheerpower:samples\client', access input ask structure cl: fields z print z end 18 |
The number of fields in a structure can be determined with the ASK STRUCTURE: FIELDS statement. The number is assigned to the numeric variable num_var.
ASK STRUCTURE struc_name: KEYS num_var
|
| Example 15-35 ASK STRUCTURE: KEYS |
|---|
open structure cl: name 'sheerpower:samples\client', access input ask structure cl: keys z print z end 2 |
The ASK STRUCTURE: KEYS statement returns the number of keys that are accessible by SheerPower. It returns the value of 0 if no keys are available.
15.8.6 ASK STRUCTURE: CAPABILITY
ASK STRUCTURE struc_name: CAPABILITY str_var
|
| Example 15-36 ASK STRUCTURE: CAPABILITY |
|---|
open structure cl: name 'sheerpower:samples\client', access input ask structure cl: capability z$ print z$ end INDEXED,INPUT |
Given a structure expression, ASK STRUCTURE: CAPABILITY sets str_expr to a comma delimited string containing one or more of the following: INDEXED, INPUT, OUTPUT
| Structure Type | Description |
|---|---|
| INDEXED | The structure is indexed; it can be accessed by key with statements such as SET STRUCTURE...KEY. |
| INPUT | You can read from the structure. |
| OUTPUT | You can write to the structure. |
| null string | The structure is not currently open. |
| Previous | Next | Contents | Index |