Lesson 14 - The Source Procedure

Top  Previous  Next


As you have seen in the previous lessons, templates can perform some amazing source code generation, greatly easing the programming that you have to do.

Sometimes you have a process that is complex, unique, or both, and a template simply doesn’t fit the requirements and specifications. Does this mean that you have to hand-code your entire project, and give up on the Application Generator?

Absolutely not! The Source Procedure template is your solution.


Source Template

The Source Procedure template provides an elegant and simple way to add hand code to your application. It provides two points at which to embed your code: the data section, and the code section.

The template simply declares the procedure, handles any optional parameters, places the embedded data declarations in the data section, begins the CODE section, then places any embedded executable code in the CODE section:


  (local data)


  (your embedded code)


Source Template Prompts

In addition to the standard Application Generator command buttons and prompts (see Application Generator in the User’s Guide), the Source template Procedure Properties dialog contains the following additional prompts:



Specify the parameter list for your procedure. See PROCEDURE and Procedure Prototypes in the Language Reference and Prototyping and Parameter Passing in the User’s Guide for more information.

The parameter list is an optional list of datatypes and labels that appear on the generated PROCEDURE statement. The entire list is enclosed in parentheses. There must be a parameter in the parameter list for each parameter defined in the procedure

prototype. We recommend providing the data type and the parameter label in both the parameter list and in the procedure prototype. For example:


You should handle the parameters in the procedure’s embedded source code.


Next: Lesson 15 - Customizing the Application: Source Embeds