Logical views

Previous Next

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.

Example 1

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:

select     pt.person_id
,          p.family_name
,          p.gender
,          t.destination
,          t.tour_type
,          s.start_date
,          s.return_date
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

Example 2

This logical view presents e-mail salutations to persons. The underlying Person table does not store the salutations in this format:

select     p.person_id
,          'Dear ' ||
           DECODE(
              p.gender
           ,  'M'
           ,  'Mr. '
           ,  'Ms. '
           ) ||
           UPPER( SUBSTR( p.family_name, 1, 1 ) ) ||
           LOWER( SUBSTR( p.family_name, 2 ) ||
           ': '
           ) salutation
from       person p

 

See also

How to define logical views

Checking logical views

Limitations of logical views

Data manipulation through logical views

Logical view column attributes

Rule-based Logical Views