BBjRecordSet::move

Description

In BBj 4.0 and higher, this method moves the current record pointer in a BBjRecordSet by a specified number of records.

Syntax

Return Value

Method

int

move(int count)

Parameters

Variable

Description

count

Specifies the number of records to move forward (positive) or backward (negative).

Return Value

Returns the actual number of records moved.

Remarks

This method never returns an error. If there are fewer records available than were requested, the current record pointer is moved as many records as possible (possibly zero).

Example

REM ' Move the current record pointer in a BBjRecordSet

REM ' First, create a data file
FILENAME$="BBjRecordSet.dat"
MODES$=""
TEMPLATE$="STATE:C(2),NAME:C(16*=)"
erase FILENAME$,err=*next
mkeyed FILENAME$,[0:1:2],0,32
channel=unt
open (channel)FILENAME$
dim REC$:TEMPLATE$

REM ' Load the file with state codes and names
while 1
dread rec.state$,rec.name$,END=*break
write record (channel)rec$
wend
close (channel)

REM ' Create a file-based BBjRecordSet
RecordSet! = BBJAPI().createFileRecordSet(FILENAME$,MODES$,TEMPLATE$)

REM ' Position at the first record
RecordSet!.first()

REM ' Move forward nine records
count = RecordSet!.move(+9)

REM ' Retrieve the RecordData for the current record
RecordData! = RecordSet!.getCurrentRecordData()

REM ' Print the RecordData
print 'lf',"The tenth RecordData is:",'LF',RecordData!,

REM ' Move backward five records
count = RecordSet!.move(-5)

REM ' Retrieve the RecordData for the current record
RecordData! = RecordSet!.getCurrentRecordData()

REM ' Print the RecordData
print 'lf',"The fifth RecordData is:",'LF',RecordData!,

stop

DATA "AK","Alaska"
DATA "AL","Alabama"
DATA "AR","Arkansas"
DATA "AZ","Arizona"
DATA "CA","California"
DATA "CO","Colorado"
DATA "CT","Connecticut"
DATA "DC","District of Columbia"
DATA "DE","Delaware"
DATA "FL","Florida"
DATA "GA","Georgia"
DATA "GU","Guam"
DATA "HI","Hawaii"
DATA "IA","Iowa"
DATA "ID","Idaho"
DATA "IL","Illinois"
DATA "IN","Indiana"
DATA "KS","Kansas"
DATA "KY","Kentucky"
DATA "LA","Louisiana"
DATA "MA","Massachusetts"
DATA "MD","Maryland"
DATA "ME","Maine"
DATA "MI","Michigan"
DATA "MN","Minnesota"
DATA "MO","Missouri"
DATA "MS","Mississippi"
DATA "MT","Montana"
DATA "NC","North Carolina"
DATA "ND","North Dakota"
DATA "NE","Nebraska"
DATA "NH","New Hampshire"
DATA "NJ","New Jersey"
DATA "NM","New Mexico"
DATA "NV","Nevada"
DATA "NY","New York"
DATA "OH","Ohio"
DATA "OK","Oklahoma"
DATA "OR","Oregon"
DATA "PA","Pennsylvania"
DATA "PR","Puerto Rico"
DATA "RI","Rhode Island"
DATA "SC","South Carolina"
DATA "SD","South Dakota"
DATA "TN","Tennessee"
DATA "TX","Texas"
DATA "UT","Utah"
DATA "VA","Virginia"
DATA "VI","Virgin Islands"
DATA "VT","Vermont"
DATA "WA","Washington"
DATA "WI","Wisconsin"
DATA "WV","West Virginia"
DATA "WY","Wyoming"

See Also

BBjAPI

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.