Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - append from add records from a database to the current database http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 append from         Add records from a database to the current database
------------------------------------------------------------------------------
 Syntax
   [!sAlias] append from sAliasSource [fields fields] ;
                         [scope] [while lExp] [for lExp]

 Arguments
   sAlias is the destination database alias to which records are appended.

   sAliasSource is the alias of the source database.

   fields is a comma-separated list of fields to add from the source
   database.

   scope is the portion of the source database file which is appended.

   lExp is a logical expression.

 Description
   The append from command adds records from sAliasSource to the current
   alias, or the alias specified by the sAlias argument. The default scope
   value for append from is all.

   If the fields list is specified, it is inclusive: only the fields found
   in the list will be copied. Force attempts to match a source field
   name with a destination field name. If a match is found, then Force
   will verify that the data types are similar and copy the data from
   the source field to the destination field. Character fields of any
   length will match. Any numeric type constitutes matching fields. All
   fields other than character and numeric must be of the same type to
   match. For example, char( 20 ) matches char( 10 ) and int matches
   dbl.

 Example
   #define EXAMPLE_DATABASE
   #include example.hdr

   dbfdef sNames
      char(10) firstname
      char(15) lastname
   enddef
   
   proc Test_appendfrom
   build "snames.dbf" from alias sNames  // create new database
   open sTest
   open sNames
   // copy one field of entire database from alias sTest to current database
   append from sTest fields sTest->lastname
   ? "Records copied", istr( areccount( sNames ) )
   close sNames
   erase "snames.dbf"
   endproc

   proc main
   Test_appendfrom()
   endproc

See Also: Database command scope table append blank copy to

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson