11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

STATUS Function Return Values<br />

After you execute SELECTINDEX, the STATUS function returns one of the values<br />

described in the following table.<br />

Value Description<br />

0 The select list is loaded with alternate key values or record IDs for the specified<br />

file.<br />

1 No alternate index key exists for this attribute using the name specified. The select<br />

list is empty.<br />

STATUS Function Return Values<br />

Examples<br />

The following program creates a select list based on alternate index LNAME, and<br />

then reads the record using the first ID retrieved from that list:<br />

OPEN 'CLIENTS' TO CLIENT.FILE ELSE ABORT<br />

SELECTINDEX 'LNAME' FROM CLIENT.FILE TO 2<br />

PRINT @(-1)<br />

READNEXT ID FROM 2 THEN<br />

READ REC FROM CLIENT.FILE, ID THEN<br />

PRINT @(5,I):REC:@(20,I):REC<br />

END ELSE<br />

PRINT "CANNOT FIND RECORD":ID<br />

END<br />

CLEARSELECT<br />

END<br />

In the following example, SELECTINDEX uses the alternate key index LNAME and<br />

creates a list of all the last names contained in the CLIENTS file:<br />

SELECTINDEX "LNAME" FROM CLIENTS<br />

In the next example, SELECTINDEX uses the alternate key value “Smith” and<br />

creates a list of all occurrences of Smith contained in the CLIENTS file:<br />

SELECTINDEX "LNAME","Smith" FROM CLIENTS<br />

SELECTINDEX 1-707

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!