home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
clarion
/
ppstpx.zip
/
OM9.TPX
< prev
next >
Wrap
Text File
|
1993-06-09
|
14KB
|
349 lines
#!------------------------------------------------------------------------------
#!
#! OM9.TPX
#!
#! %StandardHeader
#! %GenerateFormulas
#! %GenerateFormula
#! %OpenPrimary
#! %OpenSecondaryFiles
#! %GetSecondaryRecords
#! %ScreenSetupRoutine
#! %PulldownEditRoutines
#!------------------------------------------------------------------------------
#!
#GROUP(%StandardHeader)
#!------------------------------------------------------------------------------
#!
#! Standard Header
#!
#! The following statements are inserted after every PROCEDURE statement
#!
#!------------------------------------------------------------------------------
OMIT('╝')
╔════════════════════════════════════════════════════════════════════════════╗
║ %Procedure - %ProcedureDescription #<!Generated Procedure ║
╚════════════════════════════════════════════════════════════════════════════╝
#GROUP(%GenerateFormulas)
#!------------------------------------------------------------------------------
#!
#! Generate Formulas
#!
#! The formula editor generates computed fields and conditional fields.
#! Computed fields assign the value of a numeric or string expression to a
#! variable. Conditional fields evaluate a logical expression, then assign
#! the value of a true expression or a false expression to a variable. The
#! order of formulas is important because formulas may produce intermediate
#! values used in later formulas.
#!
#! Each formula has an optional class. If the symbol %CodePosition is
#! null, every formula is generated. If %CodePosition is not null, only
#! formulas with matching classes are generated.
#!
#!------------------------------------------------------------------------------
#FOR(%Formula)
#IF((UPPER(LEFT(%FormulaClass)) = UPPER(%CodePosition) OR %CodePosition = %NULL))
#IF(%FormulaType = 'COMPUTED')
%Formula = %FormulaComputation #<!%FormulaDescription
#ELSIF(%FormulaType = 'CONDITION')
IF %FormulaCondition #<!%FormulaDescription
%Formula = %FormulaTrue
#IF(%FormulaFalse)
ELSE
%Formula = %FormulaFalse
#ENDIF
END
#ENDIF
#ENDIF
#ENDFOR
#GROUP(%GenerateFormula)
#!------------------------------------------------------------------------------
#!
#! Generate Formula
#!
#! The formula editor generates computed fields and conditional fields.
#! Computed fields assign the value of a numeric or string expression to a
#! variable. Conditional fields evaluate a logical expression, then assign
#! the value of a true expression or a false expression to a variable. The
#! order of formulas is important because formulas may produce intermediate
#! values used in later formulas.
#!
#! This group will generate a single formula. If more than one formula
#! is needed, it should be placed in a template #FOR statement:
#!
#! #FOR(%Formula)
#! #INSERT(%GenerateFormula)
#! #ENDFOR
#!
#! Or, if only a selected formula class is needed:
#!
#! #FOR(%Formula)
#! #IF(%FormulaClass <> 'FILTER')
#! #INSERT(%GenerateFormula)
#! #ENDIF
#! #ENDFOR
#!
#!------------------------------------------------------------------------------
#IF(%FormulaType = 'COMPUTED')
%Formula = %FormulaComputation #<!%FormulaDescription
#ELSE
IF %FormulaCondition #<!%FormulaDescription
%Formula = %FormulaTrue
#IF(%FormulaFalse)
ELSE
%Formula = %FormulaFalse
#ENDIF
END
#ENDIF
#!------------------------------------------------------------------------------
#!
#! Open Primary
#!
#! To avoid a long delay when loading a program, each procedure opens the
#! files it uses. Opening an open file takes negligible time. %FileMode
#! contains the parameters of the OPEN statement that controls how a file
#! is accessed (read, write, etc.) and shared (share, exclusive, etc.)
#!
#!------------------------------------------------------------------------------
#GROUP(%OpenPrimary)
#INSERT(%FileMgrStart) #<!Insert File Manager. PPS
#!CheckOpen(%Primary) #<!Ensure %Primary file is open
#!------------------------------------------------------------------------------
#!
#! Get Secondary Records
#!
#! There is a secondary file for every active relationship of the primary
#! file. A relationship is active for a given procedure if any field in
#! the secondary file is in use by the screen, report, or formula editor.
#!
#!------------------------------------------------------------------------------
#GROUP(%GetSecondaryRecords) #!Get all lookup records
#FOR(%Secondary) #! for fields in the list box
#IF(%SecondaryType = 'MANY:1') #!Check for lookup files
#FIX(%File,%SecondaryTo)
#FIX(%Relation,%Secondary)
#FOR(%RelationKeyField)
%RelationKeyField = %RelationKeyFieldLink #<!Assign linking field value
#ENDFOR
GET(%Secondary,%RelationKey) #<!Lookup record
#FIX(%File,%Secondary)
IF ERRORCODE() THEN CLEAR(%FilePre:Record). #<!Clear record if unsuccessful
#ENDIF
#ENDFOR
#!------------------------------------------------------------------------------
#!
#! Open Secondary Files
#!
#! This group will open any secondary files within the file schematic.
#!
#!------------------------------------------------------------------------------
#GROUP(%OpenSecondaryFiles)
#FOR(%Secondary)
#IF(%FileMgr) #! If File Manager is used
#! then use the FileManager
#! procedure.
FileMgr('OPEN',ProcedureName,LocalFileMgrLvl,%Secondary,'%Secondary')#<!Ensure %Secondary file is open
#ELSE #! If not used then use the
#! standard Clarion CheckOpen.
#! PPS
CheckOpen(%Secondary) #<!Ensure %Secondary file is open
#ENDIF
#ENDFOR
#!------------------------------------------------------------------------------
#!
#! Screen Setup Routine
#!
#! The following statements generate Setup routines to be placed in the
#! CASE SELECTED() structure.
#!
#!------------------------------------------------------------------------------
#GROUP(%ScreenSetupRoutines)
#FOR(%ScreenField)
#IF(%ScreenFieldSetup)
OF %ScreenField #<!Setup %ScreenSetupField field
%ScreenFieldSetup
#ENDIF
#ENDFOR
#!------------------------------------------------------------------------------
#!
#! Screen Edit Routine
#!
#! The following statements generate Edit routines to be placed in the
#! CASE FIELD() structure.
#!
#!
#!------------------------------------------------------------------------------
#GROUP(%ScreenEditRoutines)
#FOR(%ScreenField)
#IF(%ScreenFieldEdit)
OF %ScreenField #<!Edit %ScreenEditField field
%ScreenFieldEdit
#ENDIF
#ENDFOR
#FOR(%PulldownField)
#IF(%PulldownFieldProc)
OF %PulldownField #<!For a selected menu item
%PulldownFieldProc #<! execute its procedure
#ENDIF
#ENDFOR
#!------------------------------------------------------------------------------
#!
#! Pulldown Field Routine
#!
#! The following statements generate Edit routines to be placed in the
#! CASE FIELD() structure for Pulldown.
#!
#!
#!------------------------------------------------------------------------------
#GROUP(%PulldownEditRoutines)
#FOR(%PulldownField) #! add all procedure or
#IF(%PulldownFieldType = 'PROCEDURE') #! source code calls
OF %PulldownField #<!For a Pulldown field
%PulldownFieldProc #<! execute its procedure
#ENDIF
#ENDFOR
#! PPS
#!------------------------------------------------------------------------------
#!
#! PPS Local Variables
#!
#! The following statements declare the local variables required for
#! various PPS template additions.
#!
#!------------------------------------------------------------------------------
#GROUP(%LocalPPSVariables)
#<! PPS Variables
ProcedureName STRING(80) #<! Procedure name holder
LocalFileMgrLvl byte #<! Local file manager level
#! PPS
#!------------------------------------------------------------------------------
#!
#! File Manager Global Variables
#!
#! The following statements declare the global variables required for the
#! file manager.
#!
#!------------------------------------------------------------------------------
#GROUP(%GlobalFileMgrVars)
FileManagerQueue QUEUE,pre(fmq) #<! File Management QUEUE
record group
ProcName string(80) #<! Procedure file opened in
FileName string(8) #<! File to be opened
FileMgrLvl byte #<! Current File manager level
.
.
#! PPS
#!------------------------------------------------------------------------------
#!
#! File Manager Start Up Procedure Calls
#!
#! The following statements are required to start the file management.
#!
#!------------------------------------------------------------------------------
#GROUP(%FileMgrStart)
#IF(%FileMgr) #! If File Manager is used
#! then use the FileManager
#! procedure.
FileMgr('LEVEL',ProcedureName,| #<!Fill LocalFileMgrLvl. PPS
LocalFileMgrLvl)
#IF(%File) #<!If files exist then
FileMgr('OPEN',ProcedureName,|
LocalFileMgrLvl,%Primary,'%Primary') #<!Ensure %Primary file is open
#ENDIF #<!End if files exist
alert(AltMinus) !Alert View hot key
#ELSE #! If not used then use the
#! standard Clarion CheckOpen.
#! PPS
CheckOpen(%Primary) #<!Ensure %Primary file is open
#ENDIF
#! PPS
#!------------------------------------------------------------------------------
#!
#! File Manager Exit Procedure Calls
#!
#! The following statements are required to exit the file manager for a
#! procedure.
#!
#!------------------------------------------------------------------------------
#GROUP(%FileMgrExit)
#IF(%FileMgr) #! If File Manager is used
#! then use the FileManager
#! procedure.
FileMgr('EXIT',ProcedureName,|
LocalFileMgrLvl) #<!Close all files. PPS
#ENDIF
#! PPS
#!------------------------------------------------------------------------------
#!
#! File Manager View Keycode Processing
#!
#! The following statements are required to call the file manager view
#! procedure.
#!
#!------------------------------------------------------------------------------
#GROUP(%FileMgrView)
#IF(%FileMgr) #! If File Manager is used
#! then call the FileManager
#! procedure.
OF AltMinus
#INSERT(%DisableFields) #!Disable all fields PPS
FileMgr('VIEW') !Call the File Manager View
#INSERT(%EnableFields) #!Enable all fields PPS
#ENDIF
#! PPS
#!------------------------------------------------------------------------------
#!
#! All field disable code
#!
#! The following statements are required to disable all fields and pulldown
#! fields.
#!
#!------------------------------------------------------------------------------
#GROUP(%DisableFields)
#FOR(%ScreenField)
#IF(%ScreenField)
disable(%ScreenField)
#ENDIF
#ENDFOR
#FOR(%PulldownField)
#IF(%PulldownField)
disable(%PulldownField)
#ENDIF
#ENDFOR
#! PPS
#!------------------------------------------------------------------------------
#!
#! All field enable code
#!
#! The following statements are required to enable all fields and pulldown
#! fields.
#!
#!------------------------------------------------------------------------------
#GROUP(%EnableFields)
#FOR(%ScreenField)
#IF(%ScreenField)
enable(%ScreenField)
#ENDIF
#ENDFOR
#FOR(%PulldownField)
#IF(%PulldownField)
enable(%PulldownField)
#ENDIF
#ENDFOR