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 - __dynindex dynamic index alias http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 __dynindex          Dynamic index alias
------------------------------------------------------------------------------
 Declaration
   database.hdr

 Syntax
   indexdef extern
      byte __dynindex
   enddef

 Default
   Non-applicable.

 Description
   __dynindex is the system-wide index alias used for indexing databases
   opened with the dynopen() function. The dynindexinit() function is used
   to set up __dynindex for the subsequent creation or use of an index file.
   Specify __dynindex as the index alias for creating and opening indexes
   with the commands index, reindex and set index to.

 Example
   #define EXAMPLE_DATABASE
   #define _DYNALIAS_
   #define _ALIASPTR_
   #include example.hdr

   #define LEN_INDEXFIELD 15
   
   vardef static
      _PALIAS pDbf                          // dynamic alias pointer
      _FLDBAG sData
   enddef
   
   proc IdxFunc static                      // index expression function
   sData.pSet := 0
   dynrep( pDbf, 2, sData )
   endproc
   
   proc Test_dynindex
   vardef
      char cFirst, cLast
   enddef
   pDbf := dynopen( 0, "stest.dbf", DO_SHARED ) // open database
   dynindexinit( "test.fdx", &IdxFunc, sData.cChar, LEN_INDEXFIELD, FT_CHAR )
   index __dynindex                         // create index
   seek "Vanderbilt"                        // seek for a name
   if found()
      sData.pSet := 0
      dynrep( pDbf, 1, sData )
      cFirst := sData.cChar
      sData.pSet := 0
      dynrep( pDbf, 2, sData )
      cLast := sData.cChar
      ? "Record found", istr( recno() ), trim( cFirst ), cLast
   endif
   endproc

   proc main
   Test_dynindex()
   endproc

See Also: dynindexinit()

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