Global Procedures
Overview
A Global Procedure is usually created to perform a recurring action. Basically, it is considered a standard program that can be reused in other projects.
This procedure does not use global variables to prevent conflicts with global variables being used in a program.
To exchange data between the program that called this procedure and the global procedure, it is mandatory to define "input" and "output" parameters.
This illustration displays the structure of a Global Procedure as is displayed in the tree view. It contains screens, routines, objects and a local procedure. |
To Add a Global Procedure to a Project
Step-by-step
1. To add a global procedure to a project, open the “Global Procedures” module, right-click and select the “Add Global Procedure” option.
2. This opens a "properties window".
In the "General" tab, enter a name for the global procedure. This name is displayed in the tree view.
Optionally, notes can be added to the global procedure.
3. Go to the "Param In" tab.
4. Define the input parameters for the global procedure, with the use of variables. See Working with the Variables Processes Group.
"Input Param Var"
In this column, define the program variable(s) (used in the global procedure) that will receive data from the outside.
"Input Param Default Value"
In the second column, as an option, define the value(s)/variable(s) that will be assigned to the "Input Param Var", in case the calling process does not map them.
"Description"
As an option, use the third column to add any relevant notes.
5. Go to the "Param Out" tab.
6. Define the output parameters for the global procedure, with the use of variables. See Working with the Variables Processes Group.
"Output Param Var"
In this column, define the program variable(s) (used in the global procedure) that will return data to the outside.
"Description"
As an option, use the second column to add any relevant notes.
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. Click to apply these choices.
Step-by-step
1. In the tree view, right-click the screen that will include the global procedure.
2. Right-click the open screen and select the "Screen properties" option OR double-click it to open the screen properties.
3. Go to the "Actions" tab.
4. Add the "Call Global Proc" process to the screen (see Working with Call Global Proc Process). The process properties window opens:
5. In the "Procedure" box, select the global procedure to be called.
6. The "Param In" automatically displays the parameters established in the "Properties" window ("Param In" tab) of the called global procedure.
Define the value(s)/variable(s) to be sent to the global procedure (mapping of the global procedure's input parameters) in the second column of the upper table.
7. The "Param Out" also displays the parameters established in the "Properties" window ("Param Out" tab) of the called global procedure.
Define the value(s) that return(s) data from the global procedure (mapping of the global procedure's output parameters), in the second column of the lower table.
Clicking
(located on the window's upper right corner), enables the creation of a global procedure.
8. Click to apply these choices and return to the "Actions" tab that initiated this operation.
9. In the "Actions" tab, add a "Go to <Exit>" Branch Process. This will return the execution flow to the line, immediately below, that, initially, called for the global procedure.
10. Click in the "Actions" tab to finish this operation.
To Add Components to a Global Procedure
In the "Global Procedures" module, right-click the global procedure (represented in the tree view) and select the component to add.
Copy |
Copies the selected global procedure. |
|
Paste |
Pastes the previously copied global procedure. This option is only visible after a "copy" operation takes place. |
|
Duplicate Global Procedure |
Duplicates the selected global procedure with all its features, objects and processes. |
|
Add Global Procedure |
Adds another global procedure to the "Global Procedure" module. |
|
Add Local Procedure |
Adds a local procedure to the selected global procedure. See Local Procedures. |
|
Add Screen |
Adds a new screen to the selected global procedure. See Creating and Editing a Screen. |
|
Add Routine |
Adds a routine to the selected global procedure. See Working with Routines. |
|
Delete |
Deletes the selected global procedure. |
|
Open All Screens |
Opens the screens included in the selected global procedure. |
|
Export Global Procedure |
Enables the exporting of the selected global procedure to "Library". See To Export a Global Procedure to Library. |
|
Import Global Procedure |
Enables the importing of a global procedure from "Library". See To Import a Global Procedure from Library. |
|
Import Screen |
Enables the importing of a screen from "Library". See To Import a Screen from Library. |
|
Import Routine |
Enables the importing of a routine from "Library". See To Import a Routine from Library. |
|
Properties |
Opens the global procedure "properties" window. |
To Import a Global Procedure from Library
Step-by-step
1. Use one of the following to access the "Library Manager" window:
A. Go to the "Menu Bar", click "Tools" and, in the resulting menu, select "Library Manager".
B. Click <F4>.
C. Right-click a global procedure or the empty space of the "Global Procedure" module and select "Import Global Procedure" from the drop-down list".
Right click a global procedure |
Right click the "Global Procedures" module |
Whichever the option chosen (A, B or C), it opens the "Library Manager" window.
If required, select a different source library or rename it by clicking . See To define a Library.
If you used the A or B option, continue to step 2.
If you used option C, proceed to step 3.
2. Select the element type ("Global Procedures") you want to import in the "Group" section, to the left.
A list of available routines for import is displayed.
3. Use one of the following to access the "Import into Project" window and continue the import operation:
a. Double-click the global procedure you want to import.
b. Drag and drop the intended global procedure into the destination project's "Global Procedures" module.
c. Select the intended global procedure and click .
d. Right-click the selected global procedure and click the "Import to Project" option.
The corresponding "Import into Project" window opens.
This window displays information that cannot be edited (regarding the global procedure being imported) and information you can edit (the "Destination" section).
4. Maintain or enter new information, as required by the project.
Import Global Proc |
Displays the global procedure's name. NOT editable. |
Displays the global procedure's author and when the global procedure was added to the library. It can also include notes entered during the export into Library operation. NOT editable. |
|
Destination |
|
Global Proc Name |
Maintain or enter a new name for the imported global procedure. Make sure the target project does not have a global procedure with the same name. |
Import Global Proc Resources (x) |
If the global procedure contains resources, check this option to ensure they are included in the import. Their destination is the target project's "Resources" module. |
It is possible to attach project resources (appended during the global procedure's export into the "Library" - see To Export a Global Procedure to Library) to the global procedure's import, even though they are not included in the global procedure.
a. To view all project resources, click .
b. Check the project resources you want to include in the import.
c. If you want, click to hide the resource list.
5. Click to conclude the global procedure import.
The newly imported global procedure is displayed in the "Global Procedures" module and ready to be used in the project.
Example of an Import Alert
The marks an occurrence. This example includes two issues:
• | The current project contains a global procedure with the same name as the one to be imported. |
• | The destination project contains resources with the same name as the ones being imported. |
Example of an Import Error
If the name of the global procedure to import already exists in the current project, the following message box opens:
a. Click and replace the existing global procedure for the newly imported one.
OR
b. Click to return to the " Import into Project" window, change the global procedure's name in the corresponding box and click
to conclude.
To Export a Global Procedure to Library
Step-by-step
1. Open the "Global Procedures" module.
2. Right-click the global procedure you want to export.
3. In the resulting menu, select "Export Global Procedure" to open the "Export to Library" window.
If required, select a different source library or rename it by clicking . See To define a Library.
4. Fill in the following options:
Global Proc Information |
|
Global Proc Name |
Displays the global procedure's name. Maintain or enter a new name. |
Text Box |
If required, add notes regarding the global procedure being exported. |
Add Global Proc Resources(x) |
If the global procedure contains resources, check this option to ensure they are included in the export. |
It is possible to append project resources to the global procedure's export, even though they are not included in the global procedure.
a. To view all project resources, click .
b. Check the project resources you want to include in the export.
c. If you want, click to hide the resource list.
5. Click to conclude the export.
The exported global procedure is available in the Library ("Global Proc" section) and ready to be imported into another project.
Example of an Export Error
If the library already contains a global procedure with the same name, the following message box appears:
a. Click to overwrite.
OR
b. Click to return to the " Export to Library" window, change the global procedure's name in the corresponding box and click
to conclude.