-Collapse +Expand

To/From Code

-Collapse +Expand Languages
-Collapse +Expand Categories
   PrestwoodBoardsTo/From GuidesReferenceDatabase   

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

ObjectPAL:   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 with an added CRLF characters too (4 characters total). Plus the "bb" will replace "This" with "bb" plus CRLF.

4. 

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).

More Info

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





Sponsored Ad
Brought to you by Prestwood IT Solutions,  Content by Mike Prestwood (owner of Prestwood IT Solutions)

We hope you are enjoying Mike's cross reference language encyclopedia! Our company is the caretaker of PrestwoodBoards.com where we pay our staff to moderate, edit, and participate. Why? Online participation is fun, we enjoy sharing information, and this is our way of promoting our I.T. services company.

We provide coding, website, and computer tech services. Keep us in mind if you or your company needs help.

Talented Developer?
If you are a talented developer and would like to work with us, start by filling out our Register for Work form.
 
744 People Online Now!!  
Online Now: Sign In to see who's online now!  Not a member? Join Prestwood now. It's free!