Tutorial 5 - Adding intelligence to the "Name" Global Template

This particular template lends itself to the creation of several Procedures to update or enforce various field requirements. During this tutorial, you will build Procedures, without specific step-by-step instructions; however, we are giving you the image of the completed Workspace plus a few hints for specific items which are not apparent from the Workspace, such as Inspector settings. Before you proceed, you should understand something about Variables.

Variables are temporary fields whose life-cycle expires with the completion of the Procedure. To use variables, select the target object in the Workspace (e.g. Calculation object), click on New variable in the Resources - Local area or drag into the Workspace object. This will load the New variable as var1, var2, etc. To assign a meaningful name to the variable, deselect the object in the Workspace, double-click the generic id (e.g. var1) in the Palette and start typing.

When using New variable's they should be "primed up" by assigning values to them in a Calculation object early on in the Procedure (e.g. assign values to an integer (var1), and float/money (var2) and text (var3) by making the following calculations: var1 = 0; var2 = 0.0 (or 0.00); var3 = ' ';.

Exercise 5 - 1, New record Procedure (Template based)

Triggered by New record (just after the fields of the previous record are cleared and the Data Entry function is ready for new input). Insert the next Numeric ID. Insert the current date into the Added to the list on field. Display the File Make Up as to total number of records vs. those where the Country equals USA. Set the Status as follows: Prospect = Yes; Customer = No; and Vendor = No.

Please Note: In a subsequent Tutorial, we will set the Customer or Vendor statuses automatically as part of our Subledger application.

Image of completed Procedure:

Retrieval of Country. Row Processing: Multiple rows (all).
Retrieval of Numeric ID. Row Processing: Single row, and Sort: Numeric ID Desc (down arrow).

Since the Subledger Number is of Text type we have to convert it (Last Account) to an Integer, do our incremental Calculation (New Account), and convert it back to a Text type (New ID) and assign it (New ID) to the Local field (Numeric ID). We use two Functions for this purpose (Text to Integer and Integer to Text).

In addition, we must test the Retrieval to determine whether it was successful (which it will not be on adding the first account).

We also use two Integer to Text Functions required to incorporate integer data in text strings.
Variables used are listed in the Local area of the Palette in the order of their utilization: USA Count, Other Count, Last Account, Conv Account, New Account, New ID, Current date, Other, and USA.

Test Result:

Exercise 5 - 2, Loading record Procedure (Template based)
This Procedure will be triggered when a previously saved record is loaded from the scrollable area of the data entry window into the editable portion of the window. In our example we have the View field "File Make Up" which will remain empty on loading unless we provide a specific instruction to display the current data.

The Retrieval object is set for Query returns: Multiple rows (all), no Search or Sort specifications are required.

Exercise 5 - 3, Saving record Procedure (Template based)
This exercise will create a Procedure (triggered when Save is clicked) that qualifies the selections made from the two pop-up lists, if any, and the integrity of the various relationships arising from those selections. If anomalies exist, Save will be aborted and suitable error messages displayed on Attention Panels.

Image of completed Procedure:

All Finish objects attached to the OK buttons have the Switch (Abort saving of record) set to ON in the Inspector. Error conditions that impact the First Name field are set (in the Inspector) to place the cursor into the First Name field.

Exercise 5 - 4, Salutation Procedure (Field based)
This Procedure will be triggered when the Salutation pop-up list is disturbed. It compares the relationship of the selected option and sets the Entity selection automatically.

Image of completed Procedure:

Please Note: Each of the Calculation objects has its own Finish object because it controls the next cursor movement through an Inspector setting. When the Entity is set to Individual, the cursor is directed to the First Name field. When the Entity is set to Select One, we retained the default instruction Select the next connected field. When the Entity is set to Corporate, the cursor is directed to the Name field.

Exercise 5 - 5, Entity Procedure (Field based)
This Procedure will be triggered when the Entity pop-up list is disturbed. It compares the relationship of the selected option and sets the Salutation selection automatically or offers suitable options.

Image of completed Procedure:

One can think even smarter and question whether both the Salutation and Entity are needed or whether a single pop-up list is adequate (e.g. selecting Mr. or Mrs. already implies Individual and if neither is picked then the First Name field must be empty). The bottom line is this: think, think, and think again as you define your needs and then build yourself the most elegant application possible.

Go To
  Tutorial 6 - General Data Entry