IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
   ► KBTo/From GuidesReferenceDatabase  Print This     

Record Movement (Cross Ref > Database)

Record Movement

Languages Focus

Top, bottom, next, and previous.

ASP Classic:   MoveFirst, MoveLast, MoveNext

ASP uses MoveFirst, MoveLast, MoveNext, and MovePrevious to move a database cursor (a RecordSet).

objRecordSet.MoveNext
Syntax Example:

The following snippet moves to the second to last record of a given RecordSet object:

objRecordSet.MoveLast
objRecordSet.MovePrevious

More Info

Corel Paradox:   home, end, nextRecord

ObjectPAL uses home(), end(), nextRecord(), priorRecord() to move a database cursor (works with either a TCursor or UIObject).

TCursor.nextRecord()

These commands send a message to the object. Specifically, they send an action constant using the action command. The above snippet is equivalent to:

TCursor.action(DataNextRecord)

It is handy to  with familiar with action constants because not all action constants have an ObjectPAL equivalent comment.

Syntax Example:

The following snippet uses the active keyword to move to the second to last record of the table attached to the UIObject that currently has focus:

active.end()
active.priorRecord()

You can also use the self keyword to refer to the UIObject your code is attached to.

More Info

Article:  An ObjectPAL Primer: Part 3


Linked Certification Question(s)

The following are practice certification questions with answers highlighted. These questions were prepared by Mike Prestwood and are intended to stress an important aspect of this KB post. All our practice questions are intended to prepare you generally for passing any certification test as well as prepare you for professional work.

Advanced

1 Advanced Level Question

Question #1: Multiple Choice

Given a text file named TextStreamTest.txt with the following contents:

This is a test.

What will the following code do?

var
 ts TextStream
endVar
  
ts.open("TextStreamTest.txt", "A")
ts.writeLine("aa")
ts.setPosition(1)
ts.writeLine("bb")
ts.close()
Answer:
1. 

The "A" is for append so the "aa" will be written to the beginning of the file with an added CRLF characters too. Plus the "bb" will replace "This" with "bb" plus CRLF.

2. 

The "A" is for replace ALL so the "aa" and "bb" will replace the whole text.

3. 

The "A" is for append so the "aa" will be written to the end of the file (2 characters total). Plus the "bb" will replace "Th" with "bb" (2 characters replace).

4. 

The "A" is for append so the "aa" will be written to the end of the file with an added CRLF characters too (4 characters total). Plus the "bb" will replace "This" with "bb" plus CRLF.

More Info

Article:  A 10 Minute ObjectPAL Quick Start
Article:  An ObjectPAL Primer: Part 1
Article:  An ObjectPAL Primer: Part 2




Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]