Views - Arizona State University

advertisement
Chapter 1:
Understanding Views
In this chapter, you will learn how to how to create and modify PeopleSoft
views using the Application Designer.
Chapter Objectives
This chapter teaches you how to:
 Use Views to Subset Data
 Create a View Definition
 Build a View
Chapter Contents
This chapter contains the following topics:
Views ........................................................................................................ 2
Views Subset Data ................................................................................... 2
Using Joins in Views ................................................................................. 3
Creating a View ........................................................................................ 6
02/16/16
1-1
Chapter 1: Understanding Views
Additional PeopleTools Topics
Views
Views used in PeopleSoft applications are the same as views used in
relational databases. They are virtual tables designed to bring in
information from one or more database tables by use of a query.
Like SQL tables, you must create a record definition for a view and keep it
synchronized with the database. Once the fields are added to the view
definition, an sql query is attached to the view to determine the records
that will fill the virtual table of the view.
Views can provide advantages over a database table:

They can subset the data contained in a table

They can join and simplify multiple tables into a single virtual table

Views can act as aggregated tables, where aggregated data are
calculated and presented as part of the data

Views can hide the complexity of data

Views do not incur any extra storage overhead

Views can provide extra security.

Row-Level Security is implemented using views.

Limit the exposure of table or tables to outer world.
Views Subset Data
Views are a construct that will query a database table and pull the
information into its own virtual table.
Partial definition of Table: PS_ADDRESSES
Emplid
1-2
Address
Type
Address1
City
State
SA0001
HOME
2333 First St.
Tempe
AZ
SA0001
WORK
2343 Second St.
Tempe
AZ
SA0002
HOME
1513 Third St.
New York
NY
SA0003
WORK
6653 East Ave
Tempe
AZ
SA0004
HOME
2345 Lincoln St.
Chicago
IL
SA0004
WORK
2343 Second St.
Tempe
AZ
Proprietary and Confidential to CedarCrestone, Inc.
and Arizona State University
02/16/16
Additional PeopleTools Topics
Chapter 1: Understanding Views
You can create a view definition that looks like:
PS_HOME_CITYST_VW
Emplid
City
State
Have the view SQL select only the HOME addresses:
select EMPLID,CITY,STATE from PS_ADDRESS where
ADDRESS_TYPE = ‘HOME’;
When a select is done from PS_HOME_CITYST_VW
select EMPLID,CITY,STATE from PS_HOME_CITYST_VW;
Resulting data would be:
Emplid
City
State
SA0001
Tempe
AZ
SA0002
New York
NY
SA0004
Chicago
IL
Using Joins in Views
Views are a good way to consolidate data from muliple database tables to
hide the complexities of the join. In essence, it’s a logical representation of
the data.
Partial definition of Table: PS_ADDRESSES
Emplid
02/16/16
Address
Type
Address1
City
State
SA0001
HOME
2333 First St.
Tempe
AZ
SA0001
WORK
2343 Second St.
Tempe
AZ
SA0002
HOME
1513 Third St.
New York
NY
SA0003
WORK
6653 East Ave
Tempe
AZ
SA0004
HOME
2345 Lincoln St.
Chicago
IL
SA0004
WORK
2343 Second St.
Tempe
AZ
Proprietary and Confidential to CedarCrestone, Inc.
and Arizona State University
1-3
Chapter 1: Understanding Views
Additional PeopleTools Topics
Partial definition of Table: PS_PERSONAL_DATA
Emplid
Birthdate
SA0001
04-04-1989
SA0002
09-20-1988
SA0003
01-14-1988
SA0004
10-13-1987
You can create a view definition that looks like:
PS_HOME_BDAY_VW
Emplid
City
State
Birthdate
Have the view SQL select only the HOME addresses:
select A.EMPLID, A.BIRTHDATE, B.CITY, B.STATE
from PS_PERSONAL_DATA A, PS_ADDRESS B
where A.EMPLID = B.EMPLID
and B.ADDRESS_TYPE = ‘HOME’;
When a select is done from PS_HOME_BDAY_VW
select EMPLID,CITY,STATE from PS_HOME_BDAY_VW;
resulting data would be:
Emplid
City
State
Birthdate
SA0001
Tempe
AZ
04-04-1989
SA0002
New York
NY
09-20-1988
SA0004
Chicago
IL
10-13-1987
Or do the select from the view that will further filter the information:
select EMPLID,CITY,STATE
from PS_HOME_BDAY_VW
where state = ‘AZ’;
Resulting data would be:
1-4
Emplid
City
State
Birthdate
SA0001
Tempe
AZ
04-04-1989
Proprietary and Confidential to CedarCrestone, Inc.
and Arizona State University
02/16/16
Additional PeopleTools Topics
Chapter 1: Understanding Views
Creating a View
Practice – Creating a View
Access the application designer
.
To create a new view definition:
Generally, it is easier to clone one of the existing record definitions
that the view will be selecting.
1. Click File
2. Click Open
3. Click Record
Choose the record you want to clone.
4. Click
5. Click File, Save As
02/16/16
Proprietary and Confidential to CedarCrestone, Inc.
and Arizona State University
1-5
Chapter 1: Understanding Views
Additional PeopleTools Topics
Record definition
names should be preceded
with ASU_ to make them easily
identified during an upgrade
process.
Also, Views should be identified
by adding _VW to the end of
the record definition name.
Add or delete appropriate fields for the view you create. Keep in mind,
for every field in the View definition there should be a corresponding
field from the record definition the view goes against.
6. Select
tab and choose SQL View
7. Click
1-6
Proprietary and Confidential to CedarCrestone, Inc.
and Arizona State University
02/16/16
Additional PeopleTools Topics
Chapter 1: Understanding Views
8. Type SQL Select statement
The order of the
columns in the select
MUST be the same as
the order in the View
definition.
9. Click Save
10. Click
02/16/16
(Build button)
Proprietary and Confidential to CedarCrestone, Inc.
and Arizona State University
1-7
Chapter 1: Understanding Views
Additional PeopleTools Topics
11. Check Create Views and Execute SQL Now
12. Click
13. Check the output window and log for any errors. Correct any
errors and re-do the build process until the view is created.
1-8
Proprietary and Confidential to CedarCrestone, Inc.
and Arizona State University
02/16/16
Download