| READ | Index Level | READT |
| Syntax | READNEXT id.variable{,value.count} {secondary} {FROM select.variable} THEN | ELSE statement.block |
| Category | BASIC |
| Type | Statement |
| Description |
retrieves the next item-id from an active list and assigns it to a specified variable.
A list must be active before the "readnext" takes place. See the "select" and "execute" statements and the "system" function (11). The list may be generated within the program using either of these statements, or the list may be passed into the program from an external process, such as TCL or a PROC, which invokes a list producing verb immediately before running this program. The "value.count" parameter indicates the position of the multi-value within an attribute. This is a by-product of an "exploded" sort, executed prior to the execution of the program. This allows multi-values to be retrieved in "exploded" sort sequence. If the list is not "exploded", the "value.count" value is always 1 (one). The "else" condition is executed when there are no more items in the list. If no "select.variable" is specified, the default "primary" or "secondary" select variable is used. The "secondary" specification uses the active "secondary" list. (See the "s" option on the list-producing verbs, such as "sselect"). See the "then/else construct" for an explanation on the use of "then" and "else" clauses in statements that allow or require them. |
| Options | |
| See Also | statements & functions SELECT EXECUTE active list secondary list THEN | ELSE statement.block statement.block IF by-exp by-exp-dsnd get-list sselect select OPEN secondary secondary list u21a3 SYSTEM EXECUTE fl FILE LOOP BEGIN WORK |
| Example |
open 'customer' to customer.file else stop 201,'customer'
execute 'sselect customer with balance.due by name' loop readnext item.id else exit read item from customer.file,item.id then print 'the name is ':item<1> end repeat The "readnext" command retrieves the next item-id from an active list, but does not implicitly address the file. The file to be accessed must be opened before an attempt to use the item-id in a "read" statement can be made. execute "select md (s" loop readnext id secondary else exit print id repeat This builds a "secondary" list and displays each item-id. |
| Warnings |
Another "select" clears the primary and secondary lists.
The "select" and "readnext" statements both consume an external list if one is available. As as result, "system(11)" always returns 0 (zero) after one of these statements. For example: execute "select bp sampling 5" print system(11) select print system(11) This prints 5, then 0. The external list is consumed by a FlashBASIC variable and is then only available from FlashBASIC. When using an external list, it is necessary to "readnext" all items in that list until the "readnext" actually fails. At this point, the list will be reset and it will again search for a new external list. |
| Compatibility | D3 7.0 AP R83 |
| READ | Index Level | READT |