home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a070 / 3.ddi / FOXPRO / TEMPLGEN / AP1KEYS.INC < prev    next >
Encoding:
Text File  |  1987-12-20  |  2.0 KB  |  96 lines

  1. <<* APPKEYS.INC *>>
  2. <<#
  3.  
  4. procedure GenIsBlank
  5. string strg
  6. begin
  7.   forall fields
  8.     if forcount = 1
  9.       strg := ''
  10.     else
  11.       strg := 'IsBlank .AND. '
  12.     endif
  13.     if fldtyp = 'N'
  14.       genln( 'IsBlank = ',strg,'(',fixfldnam,' = 0)' )
  15.     elsif fldtyp = 'D'
  16.       genln( 'IsBlank = ',strg,'(DTOC( ',fixfldnam,' ) = "  /  /  ")' )
  17.     else
  18.       genln( 'IsBlank = ',strg,'("" = TRIM( ',fixfldnam,' ))' )
  19.     endif
  20.   endfor
  21. end GenIsBlank
  22.  
  23.  
  24. procedure GenKeysBody  <<*Assumes ndxtotal > 0 *>>
  25. string  keyexpr
  26. begin
  27.   if ndxtotal > 0
  28.     <<* Use the first index as MASTER index *>>
  29.     select index 1
  30.   endif
  31.   select fields on upper(fldnam) $ upper(ndxkey)
  32.   if fldtotal = 0
  33. #>>
  34. * ---Key expression:  {ndxkey}
  35. DO SayLine WITH PromptRow,"Key expression does not match database file."
  36. WAIT
  37. @ PromptRow,0 CLEAR
  38. <<#
  39.   else
  40.     WriteGetFlds
  41.     GenIsBlank
  42.     genln( 'expr = ',fixautomem(ndxkey) )
  43.     if ndxuni
  44.       genln( 'IsUnique = .T.' )
  45.     else
  46.       genln( 'IsUnique = .F.' )
  47.     endif
  48.   endif
  49.   select all fields
  50. end GenKeysBody
  51. #>>
  52.  
  53.  
  54. <<procedure GenKeysProc>>
  55. <<begin>>
  56.  
  57. PROCEDURE {fileprefix}_KEYS
  58. PARAMETER expr,IsBlank,IsUnique
  59.    expr = ""
  60.    IsBlank = .F.
  61.    IsUnique = .F.
  62. <<#
  63.   if ismultials
  64.     pushmargin( 1 )
  65.     genln( 'DO CASE' )
  66.     forall databases
  67.       genln( 'CASE dbfarea = "',dbfcount,'"' )
  68.       pushmargin( 1 )
  69.       if ndxtotal = 0
  70.         genln( '* ---No index file available to check' )
  71.         genln( '* ---for BLANK or duplicate records.' )
  72.       else
  73.         GenKeysBody
  74.       endif
  75.       popmargin
  76.     endfor
  77.     genln( 'ENDCASE' )
  78.     popmargin
  79.   else
  80.     pushmargin( 1 )
  81.     select database 1
  82.     if ndxtotal = 0
  83.       genln( '* ---No index file available to check' )
  84.       genln( '* ---for BLANK or duplicate records.' )
  85.     else
  86.       GenKeysBody
  87.     endif
  88.     popmargin
  89.   endif
  90.   genln( 'RETURN' )
  91.   genln
  92. end <<*GenKeysProc*>>
  93.  
  94. <<* EOF: APPKEYS.INC *>>
  95. #>>
  96.