Home Page

Previous Menu

Contact Us

How do I write a template that will enter Global Variables into the appropriate embed and then display them on the Global Data Screen?

Download the code

 

The example template below will work with the ABC templates - it writes two variables into the Global Data section.  To download the code click here. Please note that the numbers on the right in square brackets [4] are not part of the template - they are used in the template description below.


#TEMPLATE (GLOVAR, 'Illustrates adding Global Variables'), FAMILY('ABC')      [1]
#!
#! Illustrate adding global variables      [2]
#! To use: in the AppGen click on Global/Extensions
#! Version 1.0
#! www.sterlingdata.com
#!
#HELP ('MYHELP.HLP')      [3]
#EXTENSION (GLOVAREX, 'Illustrates adding Global Variables - extension'), HLP('~Contents'), APPLICATION      [4]
#GLOBALDATA      [5]
GLO:MyGlobal1        STRING(50)
GLO:MyGlobal2        LONG
#ENDGLOBALDATA      [6]


[1]  Every .TPL file should have the #TEMPLATE statement at the start - the FAMILY() attribute can be 'ABC' or 'CW20' for the legacy/Clarion templates.

[2] The symbol #! means the rest of the line is a comment - it will not appear in the generated code.

[3]  #HELP() - the specified help will give instructions on using the template and should be on the Clarion path.

[4]  APPLICATION shows that this extension template must be added at Global/Extensions and cannot be used at a procedure's extensions section.

[5] This indicates the start of the Global Data section.  In a PROCEDURE #EXTENSION this would be #LOCALDATA

[6]  To mark out the end of the global data you need to use #ENDGLOBALDATA (in a Procedure extension this would be #ENDLOCALDATA)

One other point about adding global data like this - deleting the template will not delete the variables. They will already have been added to the Global Data window and should be deleted at that point.


Home Page

Previous Menu

Contact Us