home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR2 / CLATPL.ZIP / CLARION9.TPX < prev   
Text File  |  1993-07-26  |  10KB  |  258 lines

  1. #!------------------------------------------------------------------------------
  2. #!
  3. #!      CLARION9.TPX
  4. #!
  5. #!      %StandardHeader
  6. #!      %GenerateFormulas
  7. #!      %GenerateFormula
  8. #!      %OpenPrimary
  9. #!      %OpenSecondaryFiles
  10. #!      %GetSecondaryRecords
  11. #!      %ScreenSetupRoutine
  12. #!      %HotKeyRoutines
  13. #!      %PulldownEditRoutines
  14. #!      %CloseOpenedFiles
  15. #!      %CloseFilesFlags
  16. #!------------------------------------------------------------------------------
  17. #!
  18. #GROUP(%StandardHeader)
  19. #!------------------------------------------------------------------------------
  20. #!
  21. #!                            Standard Header
  22. #!
  23. #!  The following statements are inserted after every PROCEDURE statement
  24. #!
  25. #!------------------------------------------------------------------------------
  26. OMIT('╝')
  27. ╔════════════════════════════════════════════════════════════════════════════╗
  28. ║ %Procedure - %ProcedureDescription           #<!Generated Procedure        ║
  29. ╚════════════════════════════════════════════════════════════════════════════╝
  30. #GROUP(%GenerateFormulas)
  31. #!------------------------------------------------------------------------------
  32. #!
  33. #!                            Generate Formulas
  34. #!
  35. #!  The formula editor generates computed fields and conditional fields.
  36. #!  Computed fields assign the value of a numeric or string expression to a
  37. #!  variable.  Conditional fields evaluate a logical expression, then assign
  38. #!  the value of a true expression or a false expression to a variable.  The
  39. #!  order of formulas is important because formulas may produce intermediate
  40. #!  values used in later formulas.
  41. #!
  42. #!  Each formula has an optional class.  If the symbol %CodePosition is
  43. #!  null, every formula is generated.  If %CodePosition is not null, only
  44. #!  formulas with matching classes are generated.
  45. #!
  46. #!------------------------------------------------------------------------------
  47.   #FOR(%Formula)
  48.     #IF((UPPER(LEFT(%FormulaClass)) = UPPER(%CodePosition) OR %CodePosition = %NULL))
  49.       #IF(%FormulaType = 'COMPUTED')
  50. %Formula = %FormulaComputation                 #<!%FormulaDescription
  51.       #ELSIF(%FormulaType = 'CONDITION')
  52. IF %FormulaCondition                           #<!%FormulaDescription
  53.   %Formula = %FormulaTrue
  54.         #IF(%FormulaFalse)
  55. ELSE
  56.   %Formula = %FormulaFalse
  57.         #ENDIF
  58. END
  59.       #ENDIF
  60.     #ENDIF
  61.   #ENDFOR
  62. #GROUP(%GenerateFormula)
  63. #!------------------------------------------------------------------------------
  64. #!
  65. #!                            Generate Formula
  66. #!
  67. #!  The formula editor generates computed fields and conditional fields.
  68. #!  Computed fields assign the value of a numeric or string expression to a
  69. #!  variable.  Conditional fields evaluate a logical expression, then assign
  70. #!  the value of a true expression or a false expression to a variable.  The
  71. #!  order of formulas is important because formulas may produce intermediate
  72. #!  values used in later formulas.
  73. #!
  74. #!  This group will generate a single formula.  If more than one formula
  75. #!  is needed, it should be placed in a template #FOR statement:
  76. #!
  77. #!                   #FOR(%Formula)
  78. #!                     #INSERT(%GenerateFormula)
  79. #!                   #ENDFOR
  80. #!
  81. #!  Or, if only a selected formula class is needed:
  82. #!
  83. #!                   #FOR(%Formula)
  84. #!                     #IF(%FormulaClass <> 'FILTER')
  85. #!                       #INSERT(%GenerateFormula)
  86. #!                     #ENDIF
  87. #!                   #ENDFOR
  88. #!
  89. #!------------------------------------------------------------------------------
  90.      #IF(%FormulaType = 'COMPUTED')
  91. %Formula = %FormulaComputation                 #<! Computed Formula
  92.      #ELSE
  93. IF %FormulaCondition                           #<! IF FormulaCondition
  94.   %Formula = %FormulaTrue                      #<! condition is true
  95.        #IF(%FormulaFalse)
  96. ELSE
  97.   %Formula = %FormulaFalse                     #<! condition is true
  98.        #ENDIF
  99. END                                            #<! End IF FormulaCondition
  100.      #ENDIF
  101. #!------------------------------------------------------------------------------
  102. #!
  103. #!                                Open Primary
  104. #!
  105. #!  To avoid a long delay when loading a program, each procedure opens the
  106. #!  files it uses.  Opening an open file takes negligible time.  %FileMode
  107. #!  contains the parameters of the OPEN statement that controls how a file
  108. #!  is accessed (read, write, etc.) and shared (share, exclusive, etc.)
  109. #!
  110. #!------------------------------------------------------------------------------
  111. #GROUP(%OpenPrimary)
  112.   #IF(%CloseFiles)                              #!Generate function for close
  113. %Primary::Opened = CheckOpen(%Primary)         #<!Ensure %Primary file is open
  114.   #ELSE
  115. CheckOpen(%Primary)                            #<!Ensure %Primary file is open
  116.   #ENDIF
  117. #!------------------------------------------------------------------------------
  118. #!
  119. #!                          Get Secondary Records
  120. #!
  121. #!  There is a secondary file for every active relationship of the primary
  122. #!  file.  A relationship is active for a given procedure if any field in
  123. #!  the secondary file is in use by the screen, report, or formula editor.
  124. #!
  125. #!------------------------------------------------------------------------------
  126. #GROUP(%GetSecondaryRecords)                    #!Get all lookup records
  127.   #FOR(%Secondary)                              #! for fields in the list box
  128.       #IF(%SecondaryType = 'MANY:1')            #!Check for lookup files
  129.         #FIX(%File,%SecondaryTo)
  130.         #FIX(%Relation,%Secondary)
  131.         #FOR(%RelationKeyField)
  132.           #IF(%RelationKeyFieldLink)
  133. %RelationKeyField = %RelationKeyFieldLink      #<!Assign linking field value
  134.           #ENDIF
  135.         #ENDFOR
  136. GET(%Secondary,%RelationKey)                   #<!Lookup record
  137.         #FIX(%File,%Secondary)
  138. IF ERRORCODE() THEN CLEAR(%FilePre:Record).    #<!Clear record if unsuccessful
  139.       #ENDIF
  140.   #ENDFOR
  141. #!------------------------------------------------------------------------------
  142. #!
  143. #!                         Open Secondary Files
  144. #!
  145. #!  This group will open any secondary files within the file schematic.
  146. #!
  147. #!------------------------------------------------------------------------------
  148. #GROUP(%OpenSecondaryFiles)
  149.   #FOR(%Secondary)
  150.     #IF(%CloseFiles)                            #!Generate function for close
  151. %Secondary::Opened = CheckOpen(%Secondary)     #<!Ensure %Secondary file is open
  152.     #ELSE
  153. CheckOpen(%Secondary)                          #<!Ensure %Secondary file is open
  154.     #ENDIF
  155.   #ENDFOR
  156. #!------------------------------------------------------------------------------
  157. #!
  158. #!                          Screen Setup Routine
  159. #!
  160. #!  The following statements generate Setup routines to be placed in the
  161. #!  CASE SELECTED() structure.
  162. #!
  163. #!------------------------------------------------------------------------------
  164. #GROUP(%ScreenSetupRoutines)
  165.    #FOR(%ScreenField)
  166.      #IF(%ScreenFieldSetup)
  167. OF %ScreenField                                #<!Setup %ScreenSetupField field
  168.     %ScreenFieldSetup
  169.      #ENDIF
  170.    #ENDFOR
  171. #!------------------------------------------------------------------------------
  172. #!
  173. #!                          Hot Key Routines
  174. #!
  175. #!  The following statements generate a CASE structure to insert
  176. #!  calls to any Hot Key procedures which have been identified in the
  177. #!  Screen Formatter.
  178. #!
  179. #!------------------------------------------------------------------------------
  180. #GROUP(%HotKeyRoutines)
  181.   #FOR(%HotKey)
  182. CASE KEYCODE()
  183.     #FOR(%HotKey)
  184. OF %HotKey                                    #<! User defined HotKey
  185.   %HotKeyProc                                 #<! HotKey Procedure
  186.     #ENDFOR
  187. END
  188.     #BREAK
  189.   #ENDFOR
  190. #!
  191. #!------------------------------------------------------------------------------
  192. #!
  193. #!                          Screen Edit Routine
  194. #!
  195. #!  The following statements generate Edit routines to be placed in the
  196. #!  CASE FIELD() structure.
  197. #!
  198. #!
  199. #!------------------------------------------------------------------------------
  200. #GROUP(%ScreenEditRoutines)
  201.   #FOR(%ScreenField)
  202.     #IF(%ScreenFieldEdit)
  203. OF %ScreenField                                #<!Edit %ScreenEditField field
  204.   %ScreenFieldEdit
  205.     #ENDIF
  206.   #ENDFOR
  207.   #FOR(%PulldownField)
  208.     #IF(%PulldownFieldProc)
  209. OF %PulldownField                              #<!For a selected menu item
  210.   %PulldownFieldProc                           #<! execute its procedure
  211.     #ENDIF
  212.   #ENDFOR
  213. #!------------------------------------------------------------------------------
  214. #!
  215. #!                         Pulldown Field Routine
  216. #!
  217. #!  The following statements generate Edit routines to be placed in the
  218. #!  CASE FIELD() structure for Pulldown.
  219. #!
  220. #!
  221. #!------------------------------------------------------------------------------
  222. #GROUP(%PulldownEditRoutines)
  223.   #FOR(%PulldownField)                          #! add all procedure or
  224.     #IF(%PulldownFieldType = 'PROCEDURE')       #! source code calls
  225. OF %PulldownField                              #<!For a Pulldown field
  226.   %PulldownFieldProc                           #<!  execute its procedure
  227.     #ENDIF
  228.   #ENDFOR
  229. #!------------------------------------------------------------------------------
  230. #!
  231. #!                         Close Opened Files
  232. #!
  233. #!  This group will close any files opened by the current procedure
  234. #!
  235. #!------------------------------------------------------------------------------
  236. #GROUP(%CloseOpenedFiles)
  237.   #IF(%CloseFiles)                              #!Generate functio n for close
  238. IF %Primary::Opened THEN CLOSE(%Primary).      #<!Close files opened by proc
  239.     #FOR(%Secondary)
  240. IF %Secondary::Opened THEN CLOSE(%Secondary).  #<!Close files opened by proc
  241.     #ENDFOR
  242.   #ENDIF
  243. #!------------------------------------------------------------------------------
  244. #!
  245. #!                         Close Opened Files Flags
  246. #!
  247. #!  This group will declare flags to signal the procedure to close
  248. #!  the files opened by the current procedure
  249. #!
  250. #!------------------------------------------------------------------------------
  251. #GROUP(%CloseFilesFlags)
  252.   #IF(%CloseFiles)                              #!Generate function for close
  253. %Primary::Opened BYTE
  254.     #FOR(%Secondary)
  255. %Secondary::Opened BYTE
  256.     #ENDFOR
  257.   #ENDIF
  258.