You are on page 1of 16

Template Programming Overview -R17 B-1

Template Programming Overview -R17 B-2


Drawing a parallel with the steps enlisted earlier to develop a web page i.e., a T24
application, we can conclude that, all that the developer is left to do….is focus on
writing the business logic in what are called as METHODS. As you can notice, all the
other tasks are automated in Template programming.

Template Programming Overview -R17 B-3


Properties are the name of the application, its stereotype, classification etc. These are
defined in TEMPLATE. The business logic for this application is defined in what are
called as METHODS. And the T24 Application flow is already pre-defined in
THE.TEMPLATE. The new page should retain this application flow.

Template + Template Methods + THE.TEMPLATE are together referred to as T24


Application Object.

Template Programming Overview -R17 B-4


EB.DEV.HELPER is a tool which automates a major part of the web-page
development for you. After populating the field definitions in TEMPLATE and
TEMPLATE.FIELDS subroutine, you create a record in EB.DEV.HELPER for your
application. As soon as you verify this record (EB.DEV.HELPER is a W type of
application), it automatically generates entry in

PGM.FILE

FILE.CONTROL

STANDARD.SELECTION

Creates INSERT FILES

Creates Database Tables

Generates the User-Interface Layout of your web-page

Template Programming Overview -R17 B-5


Let us first understand the subroutine called TEMPLATE

Template Programming Overview -R17 B-6


Use this subroutine to specify the properties of your application like the name of the
application, display on the title bar, stereotype (H, U, L, T, W), classification (INT, FIN,
CUS) etc.

Template Programming Overview -R17 B-7


This is how T24 will use the properties that we define -

The ID of the FILE.CONTROL, STANDARD.SELECTION and PGM.FILE entry -


Table.name

The TYPE for the PGM.FILE record – Table.stereotype

The SCREEN.TITLE in PGM.FILE record – Table.title

The PRODUCT field in FILE.CONTROL and PGM.FILE – Table.product

The CLASSIFICATION field in FILE.CONTROL – Table.classification

The prefix for all fields in the I_ files – Table.equatePrefix

Functions that are not allowed for the application – Table.blockedFunctions

From the above it is evident that the TEMPLATE subroutine enlists the required
information to populate the required fields in all the related components in application
development.

Table.systemClearFile - set it to “Y” if the associated table is to be cleared when the


financial data is cleared. “N” otherwise

Table.relatedFiles – T24 applications that form part of the ID of the application. For

Template Programming Overview -R17 B-8


example: The related files for DE.PRODUCT application is COMPANY, DE.MESSAGE,
CUSTOMER and ACCOUNT.

Table.idPrefix - Set the prefix here that you want prefixed to the id that your application is
generating. EB.FORMAT.ID is a core subroutine that is called to format the ID, similar to the ID
generated in Funds Transfer.

Table.idPrefix = ‘AP’  will generate an ID in this fashion - APyydddNNNNN;NN (similar to


the Funds Transfer application for example) where the first characters are the prefix, then the
Julian Date and the 5 digit sequence number. The 2 digits after the “;” is used only for $HIS
ID’s.

Table.trigger = '' ;* Trigger field used for OPERATION style fields ie., audit fields

Template Programming Overview -R17 B-8


In order to understand the flow of the methods, you need to first understand the life-
cycle of a page. It is important for you to understand the page life cycle so that you
can write code at the appropriate life-cycle stage for the effect you intend.

Template Programming Overview -R17 B-9


In order to understand the flow of T24 Template Methods, you need to first understand
the life-cycle of a page. It is important for you to understand the page life cycle so that
you can write code at the appropriate life-cycle stage for the effect you intend.
1) Page Request - The page request from the client occurs before the page life cycle
begins
2) Page Init - A one-time page initialization like file-open etc. - .INITIALISE
3) Page Pre-Load - Page Data Control properties (of AC.DEBIT.CARD in the eg.) are
populated for the page and made ready for rendering on the client browser - .FIELDS
4) Function Check - Performs an “authorized function” check on the client request.
Based on the function entered by the user, code can be manipulated. - .FUNCTION
5) ID Check - Performs a “Valid Format for ID” check on the ID of the client request. -
.ID
6) Page Load - Reads record from table, populates the page controls with the record
data - .RECORD. The page is rendered on the client browser after the .RECORD
method.
7) Page Validate - Validate the data in the fields and generate errors, if any. -
.VALIDATE
8) Page Commit - Validate the data in the fields and generate errors followed by
overrides, if any. - .OVERRIDES and .PROCESS
9) Page Authorise - Apply the Authorise function on the record in the page. -
.AUTHORISE
10) Page Unload - Write the record in the database
Each stage in the life cycle is mapped to a method in the Template Life Cycle.

Template Programming Overview -R17 B-10


EB.DEV.HELPER performs the significant portion of the application development for
you, therefore, the web-developer is left free to focus on the business logic.
TEMPLATE generates code that you can use as a starting point for your page. But it
can only go so far. Writing the code that does the work, is your job.

The set of Methods are enlisted here, in the order in which they get executed. The
naming convention when using the methods is <Application name>.<Method name>.
These method names are hard-coded. A method named differently will be ignored.

Template Programming Overview -R17 B-11


We discussed earlier that the methods are invoked at specific intervals in the life cycle
of the page. The logic for this sequence is available in THE.TEMPLATE.
THE.TEMPLATE ensures that the threads in page execution, function together
flawlessly. All applications obey this flow of page execution. Thereby your created
web-page on client invocation will also follow the same execution flow. That’s precisely
why, care should be taken not to tamper with this code.

Template Programming Overview -R17 B-12


When the client gives a command CUSTOMER I F3, T24 invokes
VALIDATE.APPLICATION subroutine which does the initial security scrutinizing like
SMS privileges, valid browser token, valid application on PGM.FILE. On successful
verification, the subroutine internally invokes RUN.APPLICATION to render the page
on the client browser. This internally calls another subroutine
EB.EXECUTE.APPLICATION(APPLICATION.NAME) which takes the application
name from the command as the parameter. CALL @APPLICATION.NAME invokes
the TEMPLATE subroutine that has been written for CUSTOMER application and
populates Table.name with the application name which then invokes THE.TEMPLATE.
THE.TEMPLATE ensures that the customer template follows the designated life-cycle
for a page.

Template Programming Overview -R17 B-13


 I_COMMON – Common variables and arrays that are fundamental to the

development of an application in T24 are pre-declared in this insert file.

 I_EQUATE – Contains globally used equates. Equates FM to @FM, VM to

@VM, SM to @SM etc.

 I_Table – Common variables defined in TEMPLATE subroutine viz.,

Table.product, Table.name, Table.stereotype etc., are declared in the Table

object.

Template Programming Overview -R17 B-14


Template Programming Overview -R17 B-15

You might also like