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 - dyntype() determine dynamic field type http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 dyntype()           Determine dynamic field type
------------------------------------------------------------------------------
 Declaration
   database.hdr

 Syntax
   func byte dyntype extern
   param value byte    bType, ;
         value byte    bLength, ;
         value byte    bDecimals, ;
         value logical lSigned

 Arguments
   bType is the ASCII code of the dBase field type to convert. Possible
      values are 'C', 'D', 'L', 'M', and 'N'.

   bLength is the length of the field.

   bDecimals is the number of decimal places of the field.

   lSigned indicates if a numeric field's contents should be considered
   as signed.

 Return
   The dynamic type of the field.

 Description
   The dyntype() function determines the dynamic type of a field from
   its dBase field characteristics.

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

   proc Test_dyntype
   vardef
      _PALIAS pDbf
      uint    n
   enddef
   pDbf := dynopen( 0, "stest.dbf", DO_SHARED )   // open database
   if pDbf                                        // if successful
      for n := 1 to afldcnt( pDbf )
         // print the dynamic type constant for all database fields
         ? dyntype( asc( afieldtype( pDbf, n ) ), ;
            afieldlen( pDbf, n ), afielddec( pDbf, n ), .f. )
      next
   endif
   endproc

   proc main
   Test_dyntype()
   endproc

See Also: afieldtype()

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