In addition to the standard storage types, you can also use existing global field definitions in a dictionary when declaring parameter types. This second method is used when passing items such as composites to a procedure. The following example shows how a global field is used to specify parameter types.
This example procedure uses two composites as in parameters. The composite parameter type is based upon a composite global field, Account Number, defined for the application. The procedure is passed two composites as in parameters and returns a string value indicating whether the first is equal to the second.
Procedure Name |
Compare_Accounts |
in 'Account Number' Account1; in 'Account Number' Account2; out string result; if Account1 = Account2 then result = "equal to"; else result = "not equal to"; end if;
Using global field definitions as parameter types has another use. The global field definition for a window field can be used as a parameter type. This allows you to pass a specific window field, such as a list box, to a procedure as an inout parameter and manipulate it directly in the procedure. For example, you can show, hide, enable, disable, lock or unlock a field passed into the procedure in this manner.
This procedure declares a parameter type based upon the Shipping Method global field definition. The Shipping Method field is a list box. The Shipping Method field is passed into the procedure, an item is added to the list, and the list is redrawn.
Procedure Name |
Update_Shipping_Methods |
inout 'Shipping Method' Shipping_Method_List; add item "Federal Express" to Shipping_Method_List; redraw field Shipping_Method_List;
The following window pre script calls the Update_Shipping_Methods procedure, passing the Shipping Method window field to the procedure.
call Update_Shipping_Methods, field 'Shipping Method';