VIFRED Exercise

Objectives:

  1. To explore the range of facilities provided by the Ingres Visual FoRms Editor(VIFRED).
  2. To amend existing default Forms to provide a better User Interface.
  3. To explore the data validation facilities provided by VIFRED to ensure that only 'good' data is entered onto the database.
  4. To learn how VIFRED allows Forms to control NULL values at the application level.

From the top level Inges/Menu, invoke the Forms utility

Creating Forms

Following the steps listed below set up default forms using the options 'Table' and 'JoinDef' for the following objects:-
  1. Invoke the Create function.
  2. From the VIFRED - Creating a Form window, Select f(8) the Table option.
  3. In the VIFRED - Creating a Form Based on a Table window, add the tablename borrower and select the simplefields Display Format option. OK f(8) your entry.
  4. This has created a basic form. We will come back to editting it on the next step. For now:
    1. Save your form, selecting Save(f5) twice.
    2. End(f3).
  5. Repeat the above steps, using tablefields where appropriate to create all the required forms:

Altering the Screen Design

For each of the default Forms you have created, redesign the screen display to provide a better User interface.
  1. In the VIFRED - Forms Catalog, Edit the form for author, created above.
  2. Centre the AUTHOR TABLE: text.
    1. Invoke the Edit option, editting trim.
    2. Type spaces over the current AUTHOR TABLE: text and retype it, using mixed case, over the top of the table.
      Hints:
      • the 'Insert Char' key on the keyboard toggles between insert and overtype modes.
      • the <MENU KEY> is f1.
  3. Rename the column headings.
    1. Press the tab key, this move the cursor between the page heading and the actual table, press it a couple of times, watching the cursor move back and forth between the two points.
    2. With the cursor on the top left corner of the table, invoke the Edit option, this will open the VIFRED - Table Field screen.
    3. Change the Title of a Column field to read Book Number for isbnx (Column Internal Name) and Authors Name for author_name (Column Internal Name).
  4. (Still in the VIFRED - Table Field screen) Reorder the columns.
    1. Highlight the Authors Name row.
    2. Invoke the Move option.
    3. Move the current row highlight to the top of the table and invoke the Place option.
    4. End(f3) to get back to the main form.
  5. Save your form, selecting Save(f5) twice.
  6. Repeat similar operations for the other forms you have created.
    For borrower_loans, do the following:
    1. Delete the Bor State, Addr1, Addr2, Town & Post Code fields.
    2. Replace the BOOK, LOAN, COPIES TABLES: text with Books on Loan.
    3. Delete some of the blank lines between the borrower and books information.
    4. Alter the table field to:
      1. Number of Rows to Display: 12
      2. Display only the following columns, with the following titles, in the following order:
        • access_no, titled Number.
        • title, titled Title
        • loan_date, titled Loan Date
        • use the EditAttr option to set the Invisible flag to 'y' for:
          • Isbnx
          • Buy Price
          • Buy Date
          • Pub Code
          • Pub Date
          • Now Price
      Note how the tab key moves you around the various parts of a form when you are editing the form based on the borrower_loans joindef.
    5. End(f3) the edit attributes screen and use Save(f5) to save the change you have made.
    6. Now back out of the forms creation utility and invoke the Go(f8) option to run the borrower_loans form and examine how it works.

Adding Validation Checks

Set up appropriate validation checks in your Forms to ensure that only acceptable data is entered into the database. You should also provide suitable validation error messages to guide the User when invalid data is entered.

Remember, you will not be able to allow updates on borrower_reservations as it is a view based on more than one table.

For the borrower_loans form:

  1. Invoke the edit option
  2. tab down to the detail, tablefield bit (you should know which bit that is by now) and again invoke the edit option
  3. for the access_no field, invoke the EditAttr option
  4. tab to the Validation Check to Perform: field and enter detailtbl.access_no in copies.access_no
  5. change the Validation Error Message: field to This must be a valid copy number..
    Note also that the Nullable: field is set to n, this means that null values cannot be entered [as the field is a primary key]. This field can and should be set for any other field where you want to make sure that the user must enter in a value.
  6. End(f3) to get back to the table field attributes, and again to get back to the general form editing screen.
  7. Save(f5) the change you have made and run the form to try out the layout and validation checks.
BUT THIS DOESN'T WORK

Producings a Print Out of Your Form

Produce an ASCII listing of the contents of your forms.
  1. From the VIFRED - Forms Catalog highlight the author form and invoke the Utilities option.
  2. Now select the Print option and enter a filename e.g. author-form-printout.txt.
  3. Look at the content of the file you have just created.
  4. Repeat this process for the other Forms you have created.

Continue with this trainer.


This WWW material is copyright De Montfort University and may only be reproduced or used if this copyright notice is included.
This page is maintained by John Skelton. Comments or suggestions for improving this material can be emailed to jas@dmu.ac.uk) and will be gratefully received.