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 - build from alias create a database from an alias declaration http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 build from alias    Create a database from an alias declaration
------------------------------------------------------------------------------
 Syntax
   build cFile from alias sAlias

 Arguments
   cFile is the name of the database file to create.
   sAlias is the alias that controls the structure of the database to create.

 Description
   The build from alias command creates the database file specified
   by cFile and then constructs a database header from sAlias.

   The file created by build from alias is not open when the command returns,
   i. e. it is not ready for appending, replacing, etc. The file must be
   opened with the open or use command after it has been built.

 Example
   #define EXAMPLE_DATABASE
   #include example.hdr

   dbfdef sTemp1
      char( 10 )  field1
      dbl( 10:2 ) field2
      date        field3
   enddef
   
   proc Test_buildfromalias
   vardef
      uint n
   enddef
   build "stemp1.dbf" from alias sTemp1            // create new database
   open sTemp1                                     // open database
   for n := 1 to afldcnt( sTemp1 )
      ? afieldname( sTemp1, n ), afieldtype( sTemp1, n ), ; // list structure
         afieldlen( sTemp1, n ), afielddec( sTemp1, n )
   next
   close all                                       // clean up
   erase "stemp1.dbf"
   endproc

   proc main
   Test_buildfromalias()
   endproc

See Also: build from fields open

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