Local Procedures

Navigation:  How to Work with Programs > Working with Procedures >

Local Procedures

Previous pageReturn to chapter overviewNext page

 

Overview

 

A Local Procedure is a sequence of processes that acts within a program/global procedure and can only be called by that same program/global procedure.

It uses Local or Program variables to manipulate data.

 

 

To Add a Local Procedure to a Program

 

Step-by-step

 

1. Use one of the following methods to add a Local Procedure:

 

a. In the "Programs" module, right-click the program that will include the local procedure.

 

 

b. In the "Programs" module, right-click the "Local Procedure's" general entry.

 

 

2. In the resulting menu, click the “Add Local Procedure” option. This opens the local procedure's properties window.

 

 

3. In the "General" tab (open by default), enter a name for the newly created "Local Procedure" in the "Name" box. This name will be displayed in the tree view of the "Programs" module.

 

4. If necessary, add notes concerning the local procedure in the "Notes" box.

 

5. Go to the "Param In" tab.

 

 

6. Define the input parameters for the local procedure in the columns:

 

"Input Param Var"

Define the Local variable(s), within the local procedure, that receive data from outside. See Working with the Variable Processes Group.

 

"Input Param Default Value"

Optionally, define the value(s)/variable(s) that are assigned to the "Input Param Var", in case the calling process does not map them.

 

"Description"

Use this column to add a description for the input parameter - the description will be used to identify the local procedure's input parameter(s) in a "Call Local Procedure" process.

 

Use the editing icons to the right of the table to move the rows up and down and to delete or add more rows.

 

7. Go to the "Param Out" tab.

 

 

8. Define the output parameters for the local procedure:

 

"Output Param Var"

Define the Local variable(s) within the local procedure, that will return data to the program that called the local procedure.

 

"Description"

Use this column to describe the output parameter - the description will be used to identify the local procedure's output parameter(s) in a "Call Local Procedure" process.

 

Use the editing icons to the right of the table to move the rows up and down and to delete or add more rows.

 

9. Open the "Procedure" tab.

 

 

10. Add the required processes. See Adding Processes to a Routine, "Routine In", "Routine Out", Local or Global Procedures or Global Event.

 

Always end with a "Go to <End of Procedure>" process. This will return the program to the line, immediately below, that, initially, called for the local procedure.

 

 

 

11. Click to conclude the local procedure addition OR  click to abort the operation.

 

 

To Call a Local Procedure

 

It is possible to call a local procedure into an "Actions" tab (of a screen and/or a control) or a "Routine" tab (of a "routine in" or a "routine out").

You must open the intended tab and add a "Call Local Proc" process.

Once you define the local procedure you want called in the properties window of a "Call Local Proc" process (in the "General" tab), its "Send" and "Receive" tabs are automatically filled in with the "in/out parameters" you defined for the local procedure in its own properties window.

 

Example:

The local procedure "Local_Procedure_1" defined the Local variable "L_Loc_Proc1_Input" to store an input parameter and the "L_Loc_Proc1_Result" Local variable to store an output parameter. The corresponding descriptions for each variable ("Local Proc1 Input" and "Local Proc1 Result") are automatically used in the "Call Local Proc" process that calls for "Local_Procedure_1" to identify the input/output parameters.

The name of the Local variable only appears in a "Call Local Proc" process if you did NOT fill in the "Description" column of the called local procedure's "Param In"/"Param Out" tabs.

 

Local Procedure's In/Out Parameters

In ("Send" tab) /Out ("Receive" tab) Parameters of a "Call Local Proc" Process

 

 

As an alternative, you can use the following shortcut to include a local procedure to a screen, a "routine in", a "routine out" or a control:

If you drag a previously created local procedure from the "Programs" tab onto a screen/control (specifically, to the "Actions" tab) or a "routine in"/"routine out" (onto its "Routine" tab), it automatically adds a "Call Local Proc" process.

 

For a more detailed information on how to call a local procedure, see Working with Call Local Proc Process.

 

 

To Add Components to a Local Procedure

 

In the "Programs" module, right-click the intended local procedure (represented in the tree view) and select the component to add.

 

Edit

Opens the selected local procedure's properties window.

Copy

Copies the selected local procedure.

Duplicate Local Procedure

Duplicates the selected local procedure with all its features, controls and processes.

Delete

Deletes the selected local procedure.

Convert to Global Procedure

Converts the selected local procedure into a global procedure with all its features, controls and processes. The selected local procedure is automatically moved into the "Procedures" module (the "Programs" module closes and the "Procedures" module opens). See Global Procedures.

Param In

Provides direct access to the "Param In" tab.

Param Out

Provides direct access to the "Param Out" tab.

Procedure

Provides direct access to the "Procedure" tab.

Search in ...

Opens the "Search" window. See Detail of Search.

 

The "Search in..." option in this right-click menu enables an automatic to search in the selected local procedure.

 

Search 'xxx'

Opens the "Search" window. See Detail of Search.

 

The "Search 'xxx'" option in this right-click menu enables an automatic search of the text string procedure in the current project and returns all the occurrences.