Amending the Region Table’s Related Table Processing

Let’s now look at the processing of parent tables that QA Build has generated.

1. Run the Program Editor.

2. Go to Related Table Processing.
QA Build has generated processing for the REGION table, as you would expect, but it has also recognised that this table has the EMPLOYEE table as a parent. The asterisk (*) before the REGION table indicates that it is processed by the current procedure. The options you can use from this screen are:

Option

Description

Edit

Allows you to change the related table processing for the table highlighted

Delete

Removes parent checking for a related table (the asterisk is removed)

Validate/Auto set up

Generates parent checking for the highlighted table (denoted by an asterisk)

Exit (X)

Takes you back to the Table processing tab

3. Edit the related table processing for the REGION table.

4. The Table name is REGION. A program may use multiple copies of the same table, but each must have a different role. For example, it might use two copies of the SUPPLIER table, one for the principal supplier of a material and one for an alternative supplier. You could then name these roles PRINCIPAL and ALTERNATIVE.

5. Leave Identifying role as MAIN
The available Access mode options are:

Option

Description

Already fetched

Is used for processing a record which has already been read from the database. This is the normal option for enquiries, as you will see later

Check parent on database

Checks that a matching record on the database exists when you enter the key fields of the parent. This is the option currently being used

Join parent from database

Is used for displaying fields from the parent table without entering key fields. This option is more efficient than Check parent where existing records are being displayed. Do not use this option for adding new records

Prohibit parent

Checks that there isn’t a matching record on the database when you enter the key fields

6. Specify Access Mode as Check parent, which should be the default

7. Answer No to Update Table ? Updating the REGION table during the procedure is not a requirement

8. Answer Yes to Verify Table ? to check that this record is not altered by another program during the procedure

9. Answer None to Update Condition. In other situations, you may specify a condition that must be met for QA Build to allow an update to take place

10. Answer No to Allow Initial Join Fail ? Answering Yes would allow processing to continue after failing to join to the REGION table

11. Answer No to Warning Validation Only ? This means that the access mode you chose (Check parent on database) is enforced; in other words, you must enter an existing REGION_CODE

12. QA Build skips the Validation Fail question. If you had answered Yes to the previous question, when a warning validation fails, you can ask users whether they want to ignore the fact that the REGION_CODE doesn’t exist

Specifying Multiple Choice Search Method

At present, Search method is Always offer scan. When you enter the REGION_CODE key, whether the record is found or not, you can scan forwards and backwards one record at a time

A more user-friendly approach is to present a list of REGION_CODEs and highlight the one that most closely matches the REGION_CODE input by the user. The user could make a selection by scrolling up and down the list, and use a scroll bar to see any additional items that were off the screen.

To use this facility:

1. Select Multiple choice as the Search Method

2. The procedure accesses the REGION table, using its primary key of REGION_NUMBER, that is, using the main index. Accept the default for Search Index, which is Main Index

3. Use the <Enter> key to accept the default answers to the following questions:

Search depth

!

Message if no record found

125

Message when record found

None

Record scan dialog

-

When you select the multiple choice access method, QA Build needs rather more help than usual; in particular you need to provide:

·   a map to display the list of choices

·   a map to display the items, namely the REGION_CODE and REGION.NAME

Setting up the choice list

To set up the multiple choice list:

1. Select Map to display choice list, create map number 2, then choose to edit it. Design your map to look like the following:



Remember that:

·   each field is an edit control apart from the Please select a Region Code text at the top of the screen.

·   the field numbers are given under the option Control List found under Edit in the menu bar.

·   when adding the first choice field, make the size of the field large enough to accommodate the REGION_CODE and REGION.NAME fields that are to be displayed. Select the control by clicking, then copy and paste it to add the other choice fields

·   you should add a field number 100. This enables the scroll bar. You do not want field 100 visible in the finished map, so make it small, do not give it a border and position it where it is not on top of any other control

2. Set up the rows and columns on the MAP PROPERTIES screen to ensure that the cursor keys work intuitively. To arrange that the user can never move the cursor to field 100, don’t include it in your calculation of the number of rows—that is, set up the screen with 2 columns and 6 rows.

3. Save your map and exit from the map editor.

Setting up the item list

To set up the item list to display the REGION_CODE plus REGION.NAME

1. Select Map To Display Item In List, create map number 3, then choose to edit it. By adding the database fields REGION_CODE and NAME, design your map to look like this:



The two fields have no borders; they will use the borders provided by map 2. Save the map and leave the map editor.

2. Specify Map To Attach Choice List To as map 1. This redisplays the main table map after a REGION_CODE has been selected

3. In map 1 you must add an attachment point to indicate the position where map 2 is to be displayed. The top left-hand corner of the attached map will be over the top left-hand corner of the attachment point. You must allocate the attachment point a field number equal to 100 plus the number of the map being attached, so in our current program it is 100 + 2 = 102.
Note: the attachment point itself is only visible in the Map Editor; it is never displayed in the finished program and so you may safely allow it to overlie other controls in the map.

4. Accept the defaults for the remaining questions

Option

Choice

Condition to access

None

Condition on record

None

Apply to record not on db ?

No

Lock existing record ?

No

Disallow locked record ?

No

Locked record retry question

None

Confirm that the Main Table Processing screen is filled out as follows:

[screenshot goes here]

4. Click on OK and then exit the Program Editor