From: jrg@doc.ic.ac.uk (James Grinter)
Newsgroups: bit.listserv.dbase-l
Subject: Re: Specifying a record by its number.
Date: 28 Aug 92 17:18:39 GMT
Organization: Apple Haters synonymous, Department of Computing, IC, London
NNTP-Posting-Host: crane.doc.ic.ac.uk
In-reply-to: RJFS@SNYCENVM.BITNET's message of 26 Aug 92 12:57:13 GMT

In article <DBASE-L%92082605590587@NMSUVM1.BITNET> RJFS@SNYCENVM.BITNET (Joel Saunders) writes:

   On Wed, 26 Aug 1992 11:29:00 GMT P.NEWBY said:
   >Can a record be copied from one database to another by using its record number
   >?
   >
   >Database A.dbf - current
   >Database B.dbf - containing the record we want to copy.
   >
   >We can copy records from B into A with APPEND FROM b FOR b_field = 'xyz',
   >but how can we copy record number 'n' ?
   >
   >Pat Newby, University of East Anglia, UK.

   Find out the record number of the record that you want to copy and put that in
   the FOR construct. (e.g. APPEND FROM B FOR RECNO() = 25.


In article <31895.smb1@postoffice.mail.cornell.edu> smb1@CORNELL.EDU (Stephen M. Barrett) writes:

   appe from A for recno()=6  <- I've done that before

For reasons below, this wouldn't give as expected

In article <9208261456.AA16503@JayRell.CC.MsState.Edu> jgb1@CC.MSSTATE.EDU (John G 'Jay' Burrell) writes:

   One suggestion here... go to that record first (GOTO 6) then use the
   WHILE clause (append from A WHILE recno()=6). The FOR clause will search
   each and every record looking for a match.... could take a little time
   on large databases!

In article <01GO123DQZCI0004HI@INDYVAX.IUPUI.EDU> DSMITH@INDYVAX.BITNET (DON SMITH) writes:

   With Database B current, you can say:
      current_rec = RECNO()
      COPY TO temp WHILE RECNO() = current_rec
      USE Database A
      APPEND FROM temp

   This is fairly long-winded, I know.  The ideal brief syntax would be if you
   could say (with Database A current),
      APPEND FROM b WHILE RECNO() = ...something...

   That MIGHT work, but I would have to try it to be sure.  But you CAN use
   RECNO() to specify a scope...

Well, after perusing through a copy of the dBase IV 1.1 Language
Refererence manual, it seems that using APPEND FROM with RECNO() could
prove a bit awkward:

	"Further, with a FOR clause, a record in the FROM database file
is added to the active database file only if the _resulting_ record
satisfies the FOR criteria. Because the FOR condition is evaluated for
the new record instead of for the FROM database file record, some
results may not be what you expect...."

Basically APPEND FROM only takes a FOR condition, not a scope or NEXT
n parameter. I, personally, being a programmer would write my own
function to do it... (must be the Clipper inside of me). Take a range
of record numbers, read them and write them to the target file, one
record at a time.

James.



--
James Grinter,                              Dept of Computing, Imperial College
jrg@uk.ac.ic.doc (JANET)                     180, Queen's Gate, LONDON SW7 2BZ
jrg@doc.ic.ac.uk, (everyone else!); jgrinter@nyx.cs.du.edu (slower replies)
                                             "If it ain't broke, don't fix it!"
[Working... email response within a day or two at worst]
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU