A logical view presents data from one or more tables (called 'underlying tables') to the user or developer. It presents those data differently than the underlying tables do themselves.
Logical views do not store data themselves. Rather, they present data stored in the underlying table(s).
Each logical view is defined by a SQL SELECT statement that selects data from the underlying table(s).
Logical views are used:
•To assemble related data from different tables in a single meaningful view, so that the user does not have to go to all the individual tables to obtain the data. This is shown in Example 1.
•To present data differently than they are stored. This is shown in Example 2.
•To make calculations using data from underlying tables, and present the result of these calculations in screens.
In USoft Windows Designer and USoft Web Designer, you automatically get info windows and info web pages for each Logical View. This makes it easy to create interfaces that present the Logical View data to the user in a single window or in a single web page.
This logical view assembles data about participants. Unlike the underlying table Participant, it contains the start date and return date of the tour that the person is participant in, as well as the family name and gender of the participant:
from participant pt
, person p
, reservation r
, schedtour s
, tour t
relate p "TAKES PART AS" pt
, r "IS MADE FOR" pt
, s "FOR WHICH ARE MADE" r
, t "IS SCHEDULED AS" s
This logical view presents e-mail salutations to persons. The underlying Person table does not store the salutations in this format:
, 'Dear ' ||
, 'Mr. '
, 'Ms. '
UPPER( SUBSTR( p.family_name, 1, 1 ) ) ||
LOWER( SUBSTR( p.family_name, 2 ) ||
from person p