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 - _idxfunc index expression function type http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _IDXFUNC            Index expression function type
------------------------------------------------------------------------------
 Declaration
   database.hdr

 Syntax
   proc _IDXFUNC ptr

 Arguments
   None.

 Return
   None.

 Description
   The _IDXFUNC function type is used to declare a pointer to a
   procedure that serves as the index expression during dynamic indexing
   operation. The function type is used in conjunction with the
   dynindexinit() function to install an index expression function.

 Example
   #define EXAMPLE_TYPE
   #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_IDXFUNC
   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_IDXFUNC()
   endproc

See Also: dynindexinit()

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