VIFRED Exercise
Objectives:
- To explore the range of facilities provided by the Ingres Visual FoRms
Editor(VIFRED).
- To amend existing default Forms to provide a better User
Interface.
- To explore the data validation facilities provided by VIFRED to ensure
that only 'good' data is entered onto the database.
- 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:-
- borrower (table, use simplefields),
- author (table, tablefields),
- borrower_loans (joindef created in joindef exercise),
- borrower_reservations (view created in views exercise).
- Invoke the Create function.
- From the VIFRED - Creating a Form window, Select f(8) the
Table option.
- 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.
- This has created a basic form. We will come back to editting it on the
next step. For now:
- Save your form, selecting Save(f5) twice.
- End(f3).
- Repeat the above steps, using tablefields where
appropriate to create
all the required forms:
- for the Author table, create form based on a table using
tablefields layout,
- for the borrower_loans joindef, create form based on
a joindef,
- for the borrower_reservations view, create form based on a
table using
tablefields layout.
Altering the Screen Design
For each of the default Forms you have created, redesign the screen
display to provide a better User interface.
- In the VIFRED - Forms Catalog, Edit the form for
author, created above.
- Centre the AUTHOR TABLE: text.
- Invoke the Edit option, editting trim.
- 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.
- Rename the column headings.
- 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.
- With the cursor on the top left corner of the table, invoke the Edit option,
this will open the VIFRED - Table Field screen.
- 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).
- (Still in the VIFRED - Table Field screen) Reorder the columns.
- Highlight the Authors Name row.
- Invoke the Move option.
- Move the current row highlight to the top of the table and invoke the
Place option.
- End(f3) to get back to the main form.
- Save your form, selecting Save(f5) twice.
- Repeat similar operations for the other forms you have created.
- For borrower_loans, do the following:
- Delete the Bor State, Addr1, Addr2, Town & Post Code fields.
- Replace the BOOK, LOAN, COPIES TABLES: text with Books on
Loan.
- Delete some of the blank lines between the borrower and
books information.
- Alter the table field to:
- Number of Rows to Display: 12
- 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.
- End(f3) the edit attributes screen and use Save(f5) to save the change you
have made.
- 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:
- Invoke the edit option
- tab down to the detail, tablefield bit (you should know which bit that is by
now) and again invoke the edit option
- for the access_no field, invoke the EditAttr option
- tab to the Validation Check to Perform: field and enter
detailtbl.access_no in
copies.access_no
- 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.
- End(f3) to get back to the table field attributes, and again to get back to
the general form editing screen.
- 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.
- From the VIFRED - Forms Catalog
highlight the author form and invoke the Utilities option.
- Now select the Print option and enter a filename e.g.
author-form-printout.txt.
- Look at the content of
the file you have just created.
- 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.