Basic Query For PS Financials v9.0
Basic Query For PS Financials v9.0
PeopleSoft Financials
Training Participant Guide
Version 9.0
Feb 2009
Table of Contents
Before you begin… ....................................................................... vii
Intended Audience .................................................................................................... vii
How This Guide Is Organized ................................................................................... vii
Symbols and Conventions ....................................................................................... viii
Intended Audience
This guide is intended for personnel who are responsible for entering and
processing data in the PeopleSoft system.
We assume that you are familiar with Microsoft Windows. If you are new to
the Windows environment, you should complete a Windows Tutorial prior
to working in the PeopleSoft environment.
Chapter Objectives
This chapter explains:
• The agenda and objectives for this course
• The navigation to PeopleSoft Query 9.0
• Query concepts
Chapter Contents
This chapter contains the following lessons:
Lesson 1: Course Overview.....................................................................1-2
Lesson 2: Overview of Query Tables.......................................................1-4
Lesson 3: Introducing the Query Manager...............................................1-6
Review Questions: .................................................................................1-21
Lesson 1:
Course Overview
The guide includes three modules and three appendices:
• Module 1, Introducing the Query Designer, explains the objectives
for the course and provides an agenda for the course. It also provides
a brief overview of the Query tool.
• Module 2, Working with Public Queries, shows you how to run
existing queries and copy existing queries that you can modify.
• Module 3, Building Basic Queries, teaches you how to create new
queries and edit the fields to enhance the output.
• Module 4, Entering Selection Criteria, shows you how to filter the
data retrieved based on user-specified parameters.
• Module 5, Joining Records, explains how to create queries that
retrieve data from multiple tables.
• Appendix A, Financial and SCM Tables, provides a listing of some of
the more commonly used records in the AP, GL, PC, AM, PO, and IN
applications.
Agenda
Following is the one-day agenda for this course:
Morning Introductions
Module 1 – Introducing the Query Designer
Module 2 – Working with Public Queries
Module 3 – Building New Queries
Lunch
Afternoon Module 4 – Entering Selection Criteria
Module 5 – Joining Records
Workshop (if time permits)
Evaluations
Course Objectives
The purpose of this course is to provide you with the skills needed to
effectively use PeopleSoft Query to view data stored in the database. This
course teaches you how to:
• Build a basic query using one record, and use joins to perform queries
against multiple records.
• Use the various formatting options available in the query tool including
sorting, using aggregate functions to summarize data, and changing
column headings.
• Build selection criteria into a query to filter the data results.
• View the query results on the screen and in Excel.
Module Structure
Most modules are structured the same way and generally consist of the
following:
You are • Objectives. The objectives are found at the beginning of the module
encouraged to ask and define what you will learn in the module.
your instructor
questions throughout • Lessons. Each module has several lessons that explain the various
the entire course. concepts. Some lessons contain practices and exercises.
Practices are step-by-step instructions for completing a
procedure that the instructor and class participants walk-through
together.
Exercises are scenarios for you to work through on your own
during class time.
• Review Questions. You will find review questions at the end of the
module that recap material covered in the module. The answers to the
questions will be discussed among class participants and the
instructor.
Lesson 2:
Overview of Query Tables
One of the most important features of a system is the ability to access the
data maintained by the system. PeopleSoft Query is a tool that allows you
to select and report on information stored in the PeopleSoft application
tables.
To use PeopleSoft Query for reporting, you must understand the structure
of the database. Knowing which tables to access and how to find them is
the key to building successful queries.
Relational Databases
PeopleSoft’s database is a relational database. This means that data is
broken down into a series of tables. When retrieving data, the system only
accesses the tables that contain the requested data.
You can think of a relational database as a filing cabinet. The filing cabinet
represents the database. The drawers of the cabinet represent data files
or tables, while individual forms represent data records or rows.
What is a Table?
In a relational database, tables are used to store information. This
information is stored in a format that is similar to a spreadsheet. The table
The tables consists of a series of columns and rows. The columns represent the fields
that you will use most
on the various pages in the system. The rows represent the actual data on
often in your queries are
listed in Appendix A, those pages.
Financial Tables. This is a partial example of the Vendor table:
Vendor Table
Field Names
SETID VENDOR_ID NAME VENDOR VENDOR
STATUS CLASS
HC 0000000001 Western Telephone Approved Outside Party
MFG 0000000001 Superior Research Approved Outside Party
Records
MFG 0000000022 DeVille Enterprises Approved Outside Party
MFG 0000001200 Blue River Supplies Approved Outside Party
Each table in the database contains unique data, data that is not available
in any other table. Therefore, it only needs to be maintained in one place
but can be accessed from places in the application.
Lesson 3:
Introducing the Query Manager
The Query functions are located on the Reporting Tools menu. The
functions available are:
• Query Manager: Allows you to create, edit, copy, delete, rename,
run, and schedule queries.
• Query Viewer: Allows you to preview a query to see the results but
does not give you ability to edit the query.
• Schedule Query: Allows you to enter a request for the PeopleSoft
Process Scheduler to run a query at a future time in a specified
format.
To open a query:
1. From the PeopleSoft Home page, click Reporting Tools.
The menu group expands.
2. Click Query.
The Query group expands.
5. Click .
After a few moments of processing, a list of queries meeting the
search criteria appears.
Records
The Records page allows you to search for and select the data that is to
be the basis of your query. You must include records that contain the
fields you want to display in your report results.
Tip
Click the Show Fields hyperlink to open the list of fields. This helps to
determine if the record is the correct one for the query. Click the return
button again to close the list of fields.
Query
The Query page displays all the fields in the selected records. From here,
you select the fields you want in the query results.
You can add additional records using a hierarchical join and add criteria to
filter your results from this page,
Alias
The first record selected is given the alias of A, the second B, the third C,
and so on. You will see this alias in front of the field name on the Fields
tab.
Expressions
The Expressions page allows you to add new expressions or change
existing expressions.
Expressions are Expressions allow you to build new fields and display information not
an advanced Query topic contained in the PeopleSoft database by performing mathematical
and will not be covered in calculations based on existing data.
this course.
Prompts
The Prompts page allows you to create or edit prompts used in your
query.
Prompts allow you to specify selection criteria values each time you run
the query. For example, you may want to create a query that will retrieve
data for a specific period. A prompt would allow you to enter the date each
time you run the query.
Fields
The Fields page shows only the fields selected for this query. It provides
functions for you to edit the appearance of the query and allows you to see
the options currently selected. You can delete fields from the query and
you can add criteria from this page.
Column Description
Col The order in which the field is displayed in the query
results.
Record.Fieldname The field name as it is stored in the database.
Format The format of the field as it is stored in the database.
Ord Indicates a sort order selected by the user, if any.
XLAT Indicates whether the results will contain a description
from the Translate table.
Agg Indicates which, if any, summary function has been
applied to this field.
Heading Text Displays the text that will appear as the column heading
above the query results.
Add Criteria Allows the user to specify criteria for the field.
Edit Allows the user to edit the field properties.
Delete Allows the user to delete the field from the query
results.
Criteria
The Criteria page allows you to add and delete criteria. This allows you to
narrow the results to only that data meeting the parameters you specify.
This is also referred to as filtering the data.
You can set criteria up as a constant value or you can create prompts that
allow you to specify a value each time you run the query.
Having
The Having page allows you to set up criteria on a field to which you’ve
already added an aggregate function.
Adding criteria to
aggregate functions is an
advanced query topic and will An aggregate function causes you to loose the details in favor of
not be covered in this course. summary statistics when the query results are displayed.
View SQL
The View SQL page allows you to see the program that runs the query.
While you are creating your query using PeopleSoft’s user-friendly query
application, the program is automatically generating the SQL that is
SQL
stands for Structured necessary for PeopleSoft to run the query.
Query Language.
Highlight the Query SQL text and right-click to get the “Copy”
command from the menu.
Run
The Run page displays the query results.
Other Commands
You will see a row of query commands across the bottom of most pages.
Command Description
Saves the query specifications. It does not save the query
results.
Command Description
Allows you to save an existing query with a new name. This
gives you the ability to copy a public or private query so you
can create a query without starting from scratch.
Command Description
Information about the query.
Review Questions:
Chapter Objectives
This chapter explains:
• How to run a public query
• How to modify a public query
• How to rename a query
• How to delete a query
• How to export query results to Excel
Chapter Contents
This chapter contains the following lessons:
Lesson 1: Running Queries from the Query Manager .............................2-2
Lesson 2: Sending Report Results to Excel.............................................2-6
Lesson 3: Adding and Deleting Fields .....................................................2-9
Lesson 4: Performing File Functions .....................................................2-13
Review Questions: .................................................................................2-18
Lesson 1:
Running Queries from the Query Manager
The Query Manager search page allows you to find both public and private
queries. In addition to running a public query as it is, you can take it and
modify it to suit your needs. You can preview the query results on the
screen (grid control output) and you can send the data to Excel for further
formatting and analysis.
7. Click .
The query results appear.
Lesson 2:
Sending Report Results to Excel
You may want to send your report results to Excel. This is especially
helpful if:
• You want to manipulate the data or use in another format.
• You want to e-mail results to someone without access to the
PeopleSoft system.
• You want to save the results for further use.
The Excel link does not export your results to an Excel file. Instead, it puts
the results in an Excel-like table. After you get the results in an excel-like
You can use file, you can use the Save As option on the File menu to create an Excel
Crystal Reports to create a file.
report layout that is saved
and allows you to generate
a report using up-to-date
query data. However, you Data in Microsoft Excel is not automatically updated by subsequent
cannot download query queries. If you need updated information, you will need to rerun the query
results to Crystal Reports. and send the data to Excel again.
To open a query:
1. Click Query Manager.
Peoplesoft Home Â
Reporting Tools  Query Â
The Query Manager – Find an Existing Query page appears.
Query Manager 2. Enter the following in the Search by fields:
• Leave Query Name in the first field
• Type TRAINING in the second field
3. Click .
A list of queries meeting the search criteria appears.
9. Click Save.
The data is saved in an Excel format.
10. Close the browser window containing the Excel-like table.
Lesson 3:
Adding and Deleting Fields
An existing query may be very close to what you want with the exception
of a few fields. It is very easy to add and delete fields to modify your
results. You can then save your modified query using a new name,
thereby leaving the original query unchanged.
Adding fields from a table that is not part of an existing query is more
involved and is discussed in the module on Joining Records.
To open a query:
1. Click Query Manager.
Peoplesoft Home Â
The Query Manager – Find an Existing Query page appears.
Reporting Tools  Query Â
Query Manager 2. Enter the following in the Search by fields:
• Leave Query Name in the first field
• Type TRAINING in the second field
3. Click .
A list of queries meeting the search criteria appears.
4. Click on the Edit hyperlink for the TRAINING_QUERY_PO
query.
The query opens to the Fields page. All fields selected to
display in the query results appear in the list.
To add a field:
5. Click on the Query tab.
The Query page appears and all selected fields have a
checkmark.
Lesson 4:
Performing File Functions
In this lesson, we will perform the following functions:
• Save a query
• Clone (copy) a query
• Rename a query
• Delete a query
The Description
field appears on the search list
with the query name and should
help you make a query selection.
The Query Definition allows a
place to document changes and
additions to the query.
XXX=your initials
7. Type Copy of TRAINING_QUERY_PO in the Description field.
8. Select Private in the Owner field.
9. Click .
The query is cloned and the original query is closed.
6. Click .
The Enter a new name page appears.
To close a query:
1. Click Query Manager.
Peoplesoft Home  The Query Manager – Find an Existing Query page appears.
Reporting Tools  Query Â
Query Manager
To delete a query:
1. Click Query Manager.
Peoplesoft Home Â
Reporting Tools  Query  The Query Manager – Find an Existing Query page appears.
Query Manager
2. Enter the following in the Search by fields:
• Leave Query Name in the first field
• Type XXX in the second field
6. Click .
A message appears to verify the deletion.
Review Questions:
5. How do you add information about why the query was created or who authored the
query?
Module Objectives
This module teaches you how to:
• Build a query from one table
• Format the query results
• Insert an aggregate function
• Turn on the distinct feature
Module Contents
This module contains the following lessons:
Lesson 1: Query Overview.......................................................................3-2
Lesson 2: Building a Simple Query..........................................................3-5
Lesson 3: Formatting a Query ...............................................................3-10
Lesson 4: Using Aggregate Functions ...................................................3-20
Lesson 5: Using Distinct ........................................................................3-25
Review Questions ..................................................................................3-26
Lesson 1:
Query Overview
Step Action
Steps 2-5 1 Select the records you want to use in your query.
can be performed in
any order. 2 Select the fields you want to appear in your query results.
3 Save the query.
Effective-dated Records
Many of the records that you use to create queries are effective-dated,
allowing the database to contain current, future, and historical data.
When you use an effective-dated record in Query, you can specify a time
frame. For example, if you are interested only in current information, you
can avoid extracting all of the historical and future data from the database.
This message appears when you select records that are effective dated:
Criteria is
discussed in more detail This is the criteria page with effected dated criteria:
in the next module.
The following table lists each option and the results it returns.
Option Result
Effective Date <= Returns rows less than or equal to the specified date.
Effective Date >= Returns rows greater than or equal to the specified date.
Effective Date < Returns rows less than the specified date.
Effective Date > Returns rows greater than the specified date.
When you
choose an effective date First Effective Date Returns the first or oldest row of data for each item.
option, you are entering Last Effective Date Returns the last row of data for each item.
selection criteria. You only
retrieve one row for each
item in the table.
If you select one of the first four options, you also must indicate which date
to use. The following table lists each option and the results it returns.
Option Result
Current Date Uses the current system date.
Constant Uses a date that you specify as a constant or with an SQL expression.
Field Uses the date in a specified field.
Lesson 2:
Building a Simple Query
Remember that there are several steps involved in the process of building
a query. We will begin building a very simple query without any formatting
or criteria. Therefore, we will only complete four of the steps in the query
process:
• Select the records
• Select the fields
• Save the query
• Run the query
Now we can select the fields that we want to display in the query results.
As you are building a query, it is a good idea to save after each process.
To save a query:
8. Click .
The save page appears.
Query names are 10. Type Voucher listing in the Description field.
stored with uppercase letters 11. Type QUERY_TRAINING in the Folder field.
regardless of how they are
entered. A Description can 12. Select Private in the Owner field.
contain both uppercase and
lowercase letters. 13. Click .
The query is saved and the Fields page reappears.
Now that you have saved the query, run it and review the output.
To run a query:
14. Before running this query, adding date criteria might be needed
due to the quantity of data in the tables. Click on the Run tab.
After a few moments of processing, The Preview page appears
with the results of the query.
All of the fields that you selected may not be visible. Use
the bottom scroll bar to view the other fields. Use the right scroll
bar to view additional rows of data.
Lesson 3:
Formatting a Query
Query offers several options for formatting the output. You can:
• Change column headers
• Display translate table (XLAT) values instead of codes
• Change the column order
• Specify a sort order
Reorder/Sort Page
Change the heading for the CLOSE_STATUS field from the short name to
Close Status and the ENTRY_STATUS field from the short name to the
long name.
5. Click .
The new heading appears in the Heading Text column.
8. Click .
The long heading name appears in the Heading Text column.
4. Click .
The column number changes and automatically adjusts the
subsequent columns.
6. Click .
The Ord column reflects the sort applied to both fields, a 1 for
Invoice Date and a 2D for Gross Invoice Amount.
4. Click .
An S appears in the XLAT column of this field.
7. Click .
An S appears in the XLAT column of this field.
There is not an option to close a query. You can remove a query from the
screen by selecting Query Manager.
To close a query:
10. Click Query Manager.
The Query Manager – Find an Existing Query page appears.
Instructions
Use the VENDOR table to create this query.
Include the following fields:
• VENDOR_ID
• NAME1
• VENDOR_STATUS
• VENDOR_CLASS
• ENTERED_BY
Save the query as XXX _VENDORLIST and enter an appropriate
XXX=your initials description.
Change the heading for NAME1 to Vendor Name.
Retrieve the short translate (XLAT) values where possible.
Use the RFT Long headings for the Vendor Status and Vendor
Classification fields.
Sort the results alphabetically by Vendor Name.
Hints
9 Follow this path to the Query Manager:
Home  Reporting Tools  Query  Query Manager
9 After you select the fields, click the Fields tab.
Lesson 4:
Using Aggregate Functions
There may be times when you want only a data summary, not all of the
details. For instance, you may want to know how many vendors you have
in each country without actually listing every vendor.
There are several aggregate functions available in Query.
• Sum adds the values from each row and displays the total
• Count counts the number of rows
• Min checks the value from each row and returns the lowest one
• Max checks the value from each row and returns the highest one
• Average adds the values from each row and divides the result by the
number of rows
12. Click .
The new query is saved.
13. Before running this query, adding ledger criteria might be
needed due to the quantity of data in the tables. Click on the
Run tab.
The Preview page appears, and after a few moments of
processing, the results of the query are displayed.
Now add an aggregate function that averages the posted total amount.
Sort by that field in descending order.
17. Click .
18. Click .
The Edit Field Ordering page appears.
19. Type a 1 in the New Order By field for
POSTED_TOTAL_AMOUNT.
20. Turn on the Descending check box for
POSTED_TOTAL_AMOUNT.
Avg appears in the Agg column of this field. A D1 appears in the
Order column.
Change the heading for Business Unit to the RFT Long description.
23. Click .
The long heading name appears in the Heading Text column.
Instructions
Use the VENDOR_ADDR table to create this query.
Include the following fields:
• SETID
• ADDRESS_SEQ_NUM
• VENDOR_ID
• COUNTRY
Save the query as XXX _AGGREGATE.
XXX=your initials
Order by SETID, then ADDRESS_SEQ_NUM.
Hints
9 Add the aggregate function of count to the VENDOR_ID field.
Lesson 5:
Using Distinct
Sometimes when running a query, the same row of output is listed more
than once because it satisfies the query criteria in more than one case.
The Distinct button removes duplicate rows of output from the results.
Let’s say you want to know in which countries you currently have vendors.
If you query against the country field of the vendor table, each country that
has more than one vendor will appear multiple times in the results. Using
Distinct, you will see each country only once.
Review Questions
2. What are some of the formatting options available from the Fields page?
3. How do you sort the field names on the Query tab alphabetically?
Module Objectives
This module teaches you how to:
• Build parameters that filter the data
• Prompt for criteria values at run time
Module Contents
This module contains the following lessons:
Lesson 1: Criteria Overview.....................................................................4-2
Lesson 2: Adding Selection Criteria.........................................................4-5
Lesson 3: Using Wildcards ....................................................................4-14
Lesson 4: Grouping Criteria ...................................................................4-17
Lesson 5: Building a Criteria List ...........................................................4-23
Lesson 6: Using Run-Time Prompts ......................................................4-28
Lesson 7: Building Prompts from the Prompt page ...............................4-35
Review Questions ..................................................................................4-42
Lesson 1:
Criteria Overview
If you do not specify selection criteria, you will retrieve every row of data in
a table. To selectively retrieve records, you must define selection criteria,
You can or conditions, that the data must meet in order to be returned in the output.
build selection criteria For example, you may only want a list of invoices for a specific date.
around any field in the You will now use the Criteria tab to identify selection criteria. You can add
record. A field does
as many selection criteria as necessary to achieve the desired output.
not have to appear in
the results to be used
as criteria.
The Criteria tab
On the Criteria tab, each row represents one set of search conditions or
expressions for a field. Below is an example of the Criteria tab with four
rows of criteria.
Criteria Icon
The criteria icon appears on the Query tab and the Fields tab beside
each field. Click the icon on the row containing the field on which you want
to add criteria.
Field Descriptions
The columns on the Criteria tab are:
Field Description
Logical A logical expression determines if you want the next line of
criteria to be ‘in addition to’ (AND) or ‘an alternative to’ (OR)
the previous expression. All rows after the first row must
have a value in the Logical field. The default value is AND.
Expression 1 The field on which you want to base your selection criteria.
Condition The available comparison Condition Types are:
Type
• Equal to
• Greater than (not inclusive)
• Less than (not inclusive)
• In list
• Between (inclusive)
• Exists
• Like
• Is Null
• In Tree
If you are using an effective-dated table, the first criteria row will
specify the date option you chose when you first selected the table. There
are special Condition Types for this function so that only one row is
returned for each item. You can use the standard comparison Condition
Types rather than the effective-date Condition Types if you want to specify
a subset of rows to retrieve.
Effective-dated Records
Many of the records that you use to create queries are effective-dated,
allowing the database to contain current, future, and historical data.
When you use effective-dated records in Query, you specify a time frame.
For example, if you are interested only in current information, you can
avoid extracting all of the historical and future data from the database.
This message appears when you select records that are effective dated:
The following table lists each option and the results it returns.
Option Result
Effective Date <= Returns rows less than or equal to the specified date.
Effective Date >= Returns rows greater than or equal to the specified date.
Effective Date < Returns rows less than the specified date.
Effective Date > Returns rows greater than the specified date.
When you
choose an effective date First Effective Date Returns the first or oldest row of data for each item.
option, you are entering Last Effective Date Returns the last row of data for each item.
selection criteria. You only
retrieve one row for each
item in the table with all
options.
If you select one of the first four options, you also must indicate which date
to use. The following table lists each option and the results it returns.
Option Result
Current Date Uses the current system date.
Constant Uses a date that you specify as a constant or with an SQL expression.
Field Uses the date in a specified field.
Lesson 2:
Adding Selection Criteria
4. Click .
A list of records meeting the search criteria appears.
• VENDOR_CLASS
7. Click .
The save page appears.
8. Type XXX _TRAINING_QUERY_CRITERIA1 in the Query field.
XXX=your initials 9. Type Vendor List with Criteria in the Description field.
10. Type QUERY_TRAINING in the Folder field.
11. Select Private in the Owner field.
12. Click .
The new query is saved.
Now establish your search criteria for this query. Remember that you only
want to see vendors with a vendor status of approved, a classification of
outside party, and a vendor ID greater than 4000000500. Let’s add criteria
from each of the three places where it is available.
19. Click .
The Query page reappears.
20. Click on the Criteria tab.
The criteria you just added is shown on the Criteria tab.
21. Click .
The changes to the query are saved.
29. Click .
The Fields page reappears.
30. Click on the Criteria tab.
The new criteria row appears.
The word AND appears
in the Logical field of the criteria
row. This indicates that a row of
data must meet both conditions to
be selected for the output. You
can change the logical from AND
to OR if you want to select rows of
data that meet either condition.
31. Click .
The changes to the query are saved.
Now create the criteria to pull only vendors with a vendor ID greater than
4000000500.
39. Click .
The new criteria row appears.
40. Click .
The changes to the query are saved.
Format changes can be made before or after you select the criteria. Sort
this query by Vendor Name and change the XLAT codes for the vendor
status and classification fields to the short translate values.
42. Click .
The Edit Field Properties page appears.
43. Type 1 in the New Order By field for NAME1.
44. Click .
A 1 appears in the Ord column.
47. Click .
An S appears in the XLAT column for the field.
50. Click .
An S appears in the XLAT column for the field.
Instructions
Create a query that retrieves data for POs in between Jan 2008 through
March 2008, which are in a dispatched status and the PO Type equals
EMER. Also the currency code must be USD.
Use the PO_HDR table and include the following fields:
• BUSINESS_UNIT
• PO_ID
• PO_TYPE
• PO_STATUS
• PO_DT
Save the query as XXX_PO_DATA and enter an appropriate description.
Use Short Translate values for all applicable fields.
XXX=your initials
Sort the results by Business Unit, then PO ID.
Hints
9 You can add criteria on a field that does not appear in your query
results from the Query page.
9 For selected fields, it is easiest to add criteria from the Fields page.
Lesson 3:
Using Wildcards
Whereas the ‘equal to’ Condition Type can only be used when a value
matches exactly, the ‘like’ Condition Type allows you to specify a string
pattern as a comparison value. This means you can select all records that
have a similar value. For example, you could select all accounts that start
with the number 6 without having to enter a range or specify each value
individually.
Wildcards do not work with the ‘equal to’ Condition Type. They only
work with the ‘like’ Condition Type.
Examples
61% would retrieve: SMITH% would retrieve
• 61 • SMITH
• 613 • SMITHERS
• 61999999 • SMITHY
• 61A
To open a query:
1. Click Query Manager.
Peoplesoft Home  The Query Manager – Find an Existing Query page appears.
Reporting Tools  Query Â
Query Manager
2. Enter the following in the Search by fields:
• Leave Query Name in the first field
• Type XXX in the second field
XXX=your initials 3. Click
A list of queries meeting the search criteria appears.
4. Click on the Edit hyperlink for the
XXX_TRAINING_QUERY_CRITERIA1 query.
The Query opens to the Fields page.
Change the criteria so that it retrieves vendor ID’s starting with 84. Since
the vendor ID is several characters long, use the percent sign to represent
the additional characters.
9. Click .
The criteria row is changed.
Lesson 4:
Grouping Criteria
When using the AND condition and the OR condition to specify criteria, it
may be necessary to group criteria rows with parentheses to get the result
you expect. The rules of logic state that criteria linked with AND are
evaluated before those linked with OR unless the expressions are in
parentheses. Expressions in parentheses are always evaluated first.
Let’s take an example:
Consider the following rows of data:
To clone a query:
1. Click Query Manager.
Peoplesoft Home  The Query Manager – Find an Existing Query page appears.
Reporting Tools  Query Â
Query Manager 2. Enter the following in the Search by fields:
• Leave Query Name in the first field
• Type XXX in the second field.
3. Click
XXX=your initials A list of queries meeting the search criteria appears.
4. Click on the Edit hyperlink for the
XXX_TRAINING_QUERY_VOUCHERS query.
The query opens to the Fields page.
5. Click Save As.
The save page appears.
6. Type XXX_TRAINING_QUERY_CRITERIA2 in the Query field.
7. Type Vouchers with Grouped Criteria in the Description field.
8. Type QUERY_TRAINING in the Folder field.
9. Select Private in the Owner field.
10. Click .
The query is cloned.
First, enter all three criteria rows. Then group the two rows that belong
together.
To enter criteria:
17. Click .
The criteria row is complete.
24. Click .
The criteria row is complete
28. Click .
The criteria row is complete.
Now change the logical field to OR for the close status criteria row. Then
group the entry status and close status criteria rows.
31. Click .
The Edit Criteria Grouping page appears.
32. Use the edit boxes to enter parentheses around the first two
rows as shown below.
33. Click .
The Criteria page reappears and parentheses appear around
the first two rows.
Instructions
Create a query that lists payments made where the amount is greater than
$5,000,000 USD or payments made after January 1, 2008 are greater
than $750,000 USD.
Use the PAYMENT_TBL table for this query. Include the following fields:
• PYMNT_ID
• REMIT_SETID
• REMIT_VENDOR
• NAME1
• PYMNT_DT
• PYMNT_AMT
Save the query as XXX_TRAINING_QUERY_PAYMENTS and enter an
XXX=your initials appropriate description.
Change the PYMNT_DT and REMIT_SETID headings to RFT Long.
Change the NAME1 heading to Vendor Name.
Sort the results by NAME1.
Group the criteria as follows:
• Amount > $5,000,000 OR (Date > 1/1/2008 AND Amount > $750,000)
Hints
9 Use three criteria rows to define the selection criteria. One field can
be used in more than one criteria row.
9 Criteria can be added to the query without being displayed in the
results.
Lesson 5:
Building a Criteria List
Let’s say that you want to create a list of vendors in a select group of
states. Since the ‘equal to’ Condition Type can only be used with one
value, how can you accomplish this?
You could enter one criteria row for each state and change the logicals to
OR on each row as shown below:
6. Click .
The Query page appears with the selected record.
7. Select the following fields:
• SETID
• VENDOR_ID
• ADDRESS1
• ADDRESS2
• CITY
• STATE
• POSTAL
8. Click .
The save page appears.
9. Type XXX_TRAINING_QUERY_CRITERIA3 in the Query field.
XXX=your initials
10. Type Vendor addresses in the Description field.
11. Type QUERY_TRAINING in the Folder field.
13. Click .
The new query is saved.
19. Click .
AL is added to the Edit List.
20. Enter the rest of the values the same way.
21. Click .
The values selected appear in the Expression 2 box.
22. Click .
The Query page reappears.
23. Click on the Criteria tab.
The Criteria page appears with the selected criteria.
Lesson 6:
Using Run-Time Prompts
Run-time prompts provide the user submitting the query with the
opportunity to specify a criteria value at run time. Thus, if we add a prompt
on the BUSINESS_UNIT field, we can produce a query for any single
business unit without having to modify the query.
Shown below is an example of a single prompt:
All prompts appear on the Prompts tab. They are numbered consecutively,
starting with one. Prompt numbers are preceded by a colon (:).
To clone a query:
1. Click Query Manager.
Peoplesoft Home  The Query Manager – Find an Existing Query page appears.
Reporting Tools  Query Â
Query Manager 2. Enter the following in the Search by fields:
• Leave Query Name in the first field.
• Type XXX in the second field.
3. Click
A list of queries meeting the search criteria appears.
4. Click on the Edit hyperlink for the
XXX_TRAINING_QUERY_VOUCHERS query.
The query opens to the Fields page.
5. Click Save As.
The save page appears.
6. Type XXX_TRAINING_QUERY_CRITERIA4 in the Query field.
7. Type Business Unit Prompt in the Description field.
8. Type QUERY_TRAINING in the Folder field.
9. Select Private in the Owner field.
10. Click .
The query is cloned.
Create a prompt to allow the user to specify a business unit when the
query is run. Change the prompt text so that it displays the phrase, “Which
Business Unit?”
This is the prompt that will appear when you run the query.
18. Click .
A :1 appears in the Expression 2 box.
19. Click .
24. Click .
After a few moments of processing, The Run page appears with
the results of the query.
10. Click .
The Fields page reappears.
11. Click on the Criteria tab.
The Criteria page appears.
16. Click .
After a few moments of processing, The Run page appears with
the results of the query.
Instructions
Open the XXX_TRAINING_QUERY_VENDORLIST query, save it as
XXX=your initials XXX_TRAINING_QUERY_PROMPTS and enter an appropriate
description.
Create prompts for SETID and VENDOR_STATUS.
Change the heading text for the prompts to read “Enter SetID” and “Select
Vendor Status.”
Hints
9 A field does not need to be selected on the Fields tab to have criteria.
You can add criteria from the Query tab.
9 To test your query, run it using a setID of DRUMM and a status of
Approved.
Lesson 7:
Building Prompts from the Prompt page
In order to use prompts with some conditions, the prompts must exist
before the criteria is added.
Some examples are:
• You want to use the “between” condition and prompt for the first and
last date
• You want to use the “in list” condition and prompt for multiple
departments in one query
The Prompt page shows all existing prompts—including those created
while adding criteria—and lets you add additional prompts. Prompts are
numbered consecutively, starting with 1. The prompt number is preceded
by a colon (:).
To clone a query:
1. Click Query Manager.
Peoplesoft Home Â
Reporting Tools  Query  The Query Manager – Find an Existing Query page appears.
Query Manager 2. Enter the following in the Search by fields:
• Leave Query Name in the first field.
• Type XXX in the third field.
.Click .
A list of queries meeting the search criteria appears.
XXX=your initials
9. Click .
The query is cloned.
11. Click .
The Edit Prompt Properties page appears and the field name is
blank.
18. Click
The Prompts page appears with the new prompt.
19. Repeat these steps to add a second prompt on the same field.
The Heading Text should be What is your last date? for the
second prompt.
29. Click .
The Fields page reappears.
30. Click on the Criteria tab.
The Criteria page appears and the new criteria is displayed.
35. Click .
After a few moments of processing, The Run page appears with
the results of the query.
Instructions
Open the XXX_TRAINING_QUERY_VOUCHERS query, save it as
XXX=your initials XXX_TRAINING_QUERY_PROMPTS_2, and enter an appropriate
YY=your workstation # description.
Create criteria so that you can enter up to 4 business units at run-time.
Change the heading text for the prompts to read “Enter Business Unit 1-4”.
Hints
9 Create your prompts on the Prompts page before adding the criteria.
9 For the prompt, select BUSINESS_UNIT_AP for the field name.
9 For the prompt, select BUS_UNIT_AP_VW for the prompt table.
9 Create your criteria using the in list condition type.
9 To test your query, run it using the following business units: AP40X,
AP40P, CPLTD, CDLTD
It is not necessary to enter a value in all four prompt fields when you
run the query.
Review Questions
1. Where can you see the parameters that filter the query results?
6. If you build criteria for a field, is it necessary for that field to appear in the output?
Module Objectives
This module teaches you how to:
• Build parameters that filter the data
• Prompt for criteria values at run time
Module Contents
This module contains the following lessons:
Lesson 1: Criteria Overview.....................................................................4-2
Lesson 2: Adding Selection Criteria.........................................................4-5
Lesson 3: Using Wildcards ....................................................................4-14
Lesson 4: Grouping Criteria ...................................................................4-17
Lesson 5: Building a Criteria List ...........................................................4-23
Lesson 6: Using Run-Time Prompts ......................................................4-28
Lesson 7: Building Prompts from the Prompt page ...............................4-35
Review Questions ..................................................................................4-42
Lesson 1:
Criteria Overview
If you do not specify selection criteria, you will retrieve every row of data in
a table. To selectively retrieve records, you must define selection criteria,
You can or conditions, that the data must meet in order to be returned in the output.
build selection criteria For example, you may only want a list of invoices for a specific date.
around any field in the You will now use the Criteria tab to identify selection criteria. You can add
record. A field does
as many selection criteria as necessary to achieve the desired output.
not have to appear in
the results to be used
as criteria.
The Criteria tab
On the Criteria tab, each row represents one set of search conditions or
expressions for a field. Below is an example of the Criteria tab with four
rows of criteria.
Criteria Icon
The criteria icon appears on the Query tab and the Fields tab beside
each field. Click the icon on the row containing the field on which you want
to add criteria.
Field Descriptions
The columns on the Criteria tab are:
Field Description
Logical A logical expression determines if you want the next line of
criteria to be ‘in addition to’ (AND) or ‘an alternative to’ (OR)
the previous expression. All rows after the first row must
have a value in the Logical field. The default value is AND.
Expression 1 The field on which you want to base your selection criteria.
Condition The available comparison Condition Types are:
Type
• Equal to
• Greater than (not inclusive)
• Less than (not inclusive)
• In list
• Between (inclusive)
• Exists
• Like
• Is Null
• In Tree
If you are using an effective-dated table, the first criteria row will
specify the date option you chose when you first selected the table. There
are special Condition Types for this function so that only one row is
returned for each item. You can use the standard comparison Condition
Types rather than the effective-date Condition Types if you want to specify
a subset of rows to retrieve.
Effective-dated Records
Many of the records that you use to create queries are effective-dated,
allowing the database to contain current, future, and historical data.
When you use effective-dated records in Query, you specify a time frame.
For example, if you are interested only in current information, you can
avoid extracting all of the historical and future data from the database.
This message appears when you select records that are effective dated:
The following table lists each option and the results it returns.
Option Result
Effective Date <= Returns rows less than or equal to the specified date.
Effective Date >= Returns rows greater than or equal to the specified date.
Effective Date < Returns rows less than the specified date.
Effective Date > Returns rows greater than the specified date.
When you
choose an effective date First Effective Date Returns the first or oldest row of data for each item.
option, you are entering Last Effective Date Returns the last row of data for each item.
selection criteria. You only
retrieve one row for each
item in the table with all
options.
If you select one of the first four options, you also must indicate which date
to use. The following table lists each option and the results it returns.
Option Result
Current Date Uses the current system date.
Constant Uses a date that you specify as a constant or with an SQL expression.
Field Uses the date in a specified field.
Lesson 2:
Adding Selection Criteria
4. Click .
A list of records meeting the search criteria appears.
• VENDOR_CLASS
7. Click .
The save page appears.
8. Type XXX _TRAINING_QUERY_CRITERIA1 in the Query field.
XXX=your initials 9. Type Vendor List with Criteria in the Description field.
10. Type QUERY_TRAINING in the Folder field.
11. Select Private in the Owner field.
12. Click .
The new query is saved.
Now establish your search criteria for this query. Remember that you only
want to see vendors with a vendor status of approved, a classification of
outside party, and a vendor ID greater than 4000000500. Let’s add criteria
from each of the three places where it is available.
19. Click .
The Query page reappears.
20. Click on the Criteria tab.
The criteria you just added is shown on the Criteria tab.
21. Click .
The changes to the query are saved.
29. Click .
The Fields page reappears.
30. Click on the Criteria tab.
The new criteria row appears.
The word AND appears
in the Logical field of the criteria
row. This indicates that a row of
data must meet both conditions to
be selected for the output. You
can change the logical from AND
to OR if you want to select rows of
data that meet either condition.
31. Click .
The changes to the query are saved.
Now create the criteria to pull only vendors with a vendor ID greater than
4000000500.
39. Click .
The new criteria row appears.
40. Click .
The changes to the query are saved.
Format changes can be made before or after you select the criteria. Sort
this query by Vendor Name and change the XLAT codes for the vendor
status and classification fields to the short translate values.
42. Click .
The Edit Field Properties page appears.
43. Type 1 in the New Order By field for NAME1.
44. Click .
A 1 appears in the Ord column.
47. Click .
An S appears in the XLAT column for the field.
50. Click .
An S appears in the XLAT column for the field.
Instructions
Create a query that retrieves data for POs in between Jan 2008 through
March 2008, which are in a dispatched status and the PO Type equals
EMER. Also the currency code must be USD.
Use the PO_HDR table and include the following fields:
• BUSINESS_UNIT
• PO_ID
• PO_TYPE
• PO_STATUS
• PO_DT
Save the query as XXX_PO_DATA and enter an appropriate description.
Use Short Translate values for all applicable fields.
XXX=your initials
Sort the results by Business Unit, then PO ID.
Hints
9 You can add criteria on a field that does not appear in your query
results from the Query page.
9 For selected fields, it is easiest to add criteria from the Fields page.
Lesson 3:
Using Wildcards
Whereas the ‘equal to’ Condition Type can only be used when a value
matches exactly, the ‘like’ Condition Type allows you to specify a string
pattern as a comparison value. This means you can select all records that
have a similar value. For example, you could select all accounts that start
with the number 6 without having to enter a range or specify each value
individually.
Wildcards do not work with the ‘equal to’ Condition Type. They only
work with the ‘like’ Condition Type.
Examples
61% would retrieve: SMITH% would retrieve
• 61 • SMITH
• 613 • SMITHERS
• 61999999 • SMITHY
• 61A
To open a query:
1. Click Query Manager.
Peoplesoft Home  The Query Manager – Find an Existing Query page appears.
Reporting Tools  Query Â
Query Manager
2. Enter the following in the Search by fields:
• Leave Query Name in the first field
• Type XXX in the second field
XXX=your initials 3. Click
A list of queries meeting the search criteria appears.
4. Click on the Edit hyperlink for the
XXX_TRAINING_QUERY_CRITERIA1 query.
The Query opens to the Fields page.
Change the criteria so that it retrieves vendor ID’s starting with 84. Since
the vendor ID is several characters long, use the percent sign to represent
the additional characters.
9. Click .
The criteria row is changed.
Lesson 4:
Grouping Criteria
When using the AND condition and the OR condition to specify criteria, it
may be necessary to group criteria rows with parentheses to get the result
you expect. The rules of logic state that criteria linked with AND are
evaluated before those linked with OR unless the expressions are in
parentheses. Expressions in parentheses are always evaluated first.
Let’s take an example:
Consider the following rows of data:
To clone a query:
1. Click Query Manager.
Peoplesoft Home  The Query Manager – Find an Existing Query page appears.
Reporting Tools  Query Â
Query Manager 2. Enter the following in the Search by fields:
• Leave Query Name in the first field
• Type XXX in the second field.
3. Click
XXX=your initials A list of queries meeting the search criteria appears.
4. Click on the Edit hyperlink for the
XXX_TRAINING_QUERY_VOUCHERS query.
The query opens to the Fields page.
5. Click Save As.
The save page appears.
6. Type XXX_TRAINING_QUERY_CRITERIA2 in the Query field.
7. Type Vouchers with Grouped Criteria in the Description field.
8. Type QUERY_TRAINING in the Folder field.
9. Select Private in the Owner field.
10. Click .
The query is cloned.
First, enter all three criteria rows. Then group the two rows that belong
together.
To enter criteria:
17. Click .
The criteria row is complete.
24. Click .
The criteria row is complete
28. Click .
The criteria row is complete.
Now change the logical field to OR for the close status criteria row. Then
group the entry status and close status criteria rows.
31. Click .
The Edit Criteria Grouping page appears.
32. Use the edit boxes to enter parentheses around the first two
rows as shown below.
33. Click .
The Criteria page reappears and parentheses appear around
the first two rows.
Instructions
Create a query that lists payments made where the amount is greater than
$5,000,000 USD or payments made after January 1, 2008 are greater
than $750,000 USD.
Use the PAYMENT_TBL table for this query. Include the following fields:
• PYMNT_ID
• REMIT_SETID
• REMIT_VENDOR
• NAME1
• PYMNT_DT
• PYMNT_AMT
Save the query as XXX_TRAINING_QUERY_PAYMENTS and enter an
XXX=your initials appropriate description.
Change the PYMNT_DT and REMIT_SETID headings to RFT Long.
Change the NAME1 heading to Vendor Name.
Sort the results by NAME1.
Group the criteria as follows:
• Amount > $5,000,000 OR (Date > 1/1/2008 AND Amount > $750,000)
Hints
9 Use three criteria rows to define the selection criteria. One field can
be used in more than one criteria row.
9 Criteria can be added to the query without being displayed in the
results.
Lesson 5:
Building a Criteria List
Let’s say that you want to create a list of vendors in a select group of
states. Since the ‘equal to’ Condition Type can only be used with one
value, how can you accomplish this?
You could enter one criteria row for each state and change the logicals to
OR on each row as shown below:
6. Click .
The Query page appears with the selected record.
7. Select the following fields:
• SETID
• VENDOR_ID
• ADDRESS1
• ADDRESS2
• CITY
• STATE
• POSTAL
8. Click .
The save page appears.
9. Type XXX_TRAINING_QUERY_CRITERIA3 in the Query field.
XXX=your initials
10. Type Vendor addresses in the Description field.
11. Type QUERY_TRAINING in the Folder field.
13. Click .
The new query is saved.
19. Click .
AL is added to the Edit List.
20. Enter the rest of the values the same way.
21. Click .
The values selected appear in the Expression 2 box.
22. Click .
The Query page reappears.
23. Click on the Criteria tab.
The Criteria page appears with the selected criteria.
Lesson 6:
Using Run-Time Prompts
Run-time prompts provide the user submitting the query with the
opportunity to specify a criteria value at run time. Thus, if we add a prompt
on the BUSINESS_UNIT field, we can produce a query for any single
business unit without having to modify the query.
Shown below is an example of a single prompt:
All prompts appear on the Prompts tab. They are numbered consecutively,
starting with one. Prompt numbers are preceded by a colon (:).
To clone a query:
1. Click Query Manager.
Peoplesoft Home  The Query Manager – Find an Existing Query page appears.
Reporting Tools  Query Â
Query Manager 2. Enter the following in the Search by fields:
• Leave Query Name in the first field.
• Type XXX in the second field.
3. Click
A list of queries meeting the search criteria appears.
4. Click on the Edit hyperlink for the
XXX_TRAINING_QUERY_VOUCHERS query.
The query opens to the Fields page.
5. Click Save As.
The save page appears.
6. Type XXX_TRAINING_QUERY_CRITERIA4 in the Query field.
7. Type Business Unit Prompt in the Description field.
8. Type QUERY_TRAINING in the Folder field.
9. Select Private in the Owner field.
10. Click .
The query is cloned.
Create a prompt to allow the user to specify a business unit when the
query is run. Change the prompt text so that it displays the phrase, “Which
Business Unit?”
This is the prompt that will appear when you run the query.
18. Click .
A :1 appears in the Expression 2 box.
19. Click .
24. Click .
After a few moments of processing, The Run page appears with
the results of the query.
10. Click .
The Fields page reappears.
11. Click on the Criteria tab.
The Criteria page appears.
16. Click .
After a few moments of processing, The Run page appears with
the results of the query.
Instructions
Open the XXX_TRAINING_QUERY_VENDORLIST query, save it as
XXX=your initials XXX_TRAINING_QUERY_PROMPTS and enter an appropriate
description.
Create prompts for SETID and VENDOR_STATUS.
Change the heading text for the prompts to read “Enter SetID” and “Select
Vendor Status.”
Hints
9 A field does not need to be selected on the Fields tab to have criteria.
You can add criteria from the Query tab.
9 To test your query, run it using a setID of DRUMM and a status of
Approved.
Lesson 7:
Building Prompts from the Prompt page
In order to use prompts with some conditions, the prompts must exist
before the criteria is added.
Some examples are:
• You want to use the “between” condition and prompt for the first and
last date
• You want to use the “in list” condition and prompt for multiple
departments in one query
The Prompt page shows all existing prompts—including those created
while adding criteria—and lets you add additional prompts. Prompts are
numbered consecutively, starting with 1. The prompt number is preceded
by a colon (:).
To clone a query:
1. Click Query Manager.
Peoplesoft Home Â
Reporting Tools  Query  The Query Manager – Find an Existing Query page appears.
Query Manager 2. Enter the following in the Search by fields:
• Leave Query Name in the first field.
• Type XXX in the third field.
.Click .
A list of queries meeting the search criteria appears.
XXX=your initials
9. Click .
The query is cloned.
11. Click .
The Edit Prompt Properties page appears and the field name is
blank.
18. Click
The Prompts page appears with the new prompt.
19. Repeat these steps to add a second prompt on the same field.
The Heading Text should be What is your last date? for the
second prompt.
29. Click .
The Fields page reappears.
30. Click on the Criteria tab.
The Criteria page appears and the new criteria is displayed.
35. Click .
After a few moments of processing, The Run page appears with
the results of the query.
Instructions
Open the XXX_TRAINING_QUERY_VOUCHERS query, save it as
XXX=your initials XXX_TRAINING_QUERY_PROMPTS_2, and enter an appropriate
YY=your workstation # description.
Create criteria so that you can enter up to 4 business units at run-time.
Change the heading text for the prompts to read “Enter Business Unit 1-4”.
Hints
9 Create your prompts on the Prompts page before adding the criteria.
9 For the prompt, select BUSINESS_UNIT_AP for the field name.
9 For the prompt, select BUS_UNIT_AP_VW for the prompt table.
9 Create your criteria using the in list condition type.
9 To test your query, run it using the following business units: AP40X,
AP40P, CPLTD, CDLTD
It is not necessary to enter a value in all four prompt fields when you
run the query.
Review Questions
1. Where can you see the parameters that filter the query results?
6. If you build criteria for a field, is it necessary for that field to appear in the output?
Module Objectives
This module teaches you how to:
• Distinguish between the different types of joins
• Join records with an established relationship
Module Contents
This module contains the following lessons:
Lesson 1: Overview of Joins and Record Relationships..........................5-2
Lesson 2: Joining Hierarchical Records...................................................5-7
Lesson 3: Joining Related Records .......................................................5-15
Review Questions ..................................................................................5-20
Lesson 1:
Overview of Joins and Record Relationships
There may be times when you need to display data from multiple tables in
one query. This is accomplished using record joins. In order to join records
effectively, you must understand how the tables relate to each other.
In this lesson, you learn about the different record relationships in
PeopleSoft and how they are used to join records.
Joining Records
Query enables you to query against multiple tables using joins. Joins link
multiple records together so that you can use them in one query.
Records are joined on their common fields. Often, the common fields are
also the key fields. Every record in the system has key fields that uniquely
identify the data contained within the record. Key fields are identified with
a key icon in front of the field name on the Query page.
When you link tables using common fields, you ensure that you do not
retrieve duplicate data in your query results. For example, if you want to
join the VENDOR record to the VENDOR_ADDR record, you want the
system to look for the rows in each record where the SETID and
VENDOR_ID (the key fields) are the same.
Look at the two records below:
VENDOR Record
SETID VENDOR_ID NAME1 VENDOR_CLASS
HC 000001 Main Street Courier R
MFG 000001 Robert’s Packaging R
MFG 000002 Sandy’s Office Supplies R
MFG 000003 Harvey’s Cleaning Service R
VENDOR_ADDR Record
SETID VENDOR_ID ADDRESS1 PHONE
HC 000001 123 Oak Park Dr. 555-1212
MFG 000002 820 Lenox Rd. 555-4321
Running a query against these records without first joining them would
produce the following output:
SETID VENDOR NAME1 CLASS ADDRESS1 PHONE
When the system does not know how to link the two tables together, it
creates a row for every combination of the two records. Since the first
record has three rows and the second has two, you end up with six rows.
This is called a Cartesian join and is not what you want. Improperly joined
records can cause serious performance problems with large queries.
These records have two common fields: SETID and VENDOR_ID. These
fields are also key fields. If you joined the records using the common fields
and ran the query, you would have the following result with an equivalent
join:
SETID VENDOR NAME1 CLASS ADDRESS1 PHONE
HC 000001 Main Street Courier R 123 Oak Park Dr. 555-1212
MFG 000002 Jan’s Office Supplies R 820 Lenox Rd. 555-4321
Notice that there are only two rows of data in the output. When you join
records, only matching rows in both records are selected. Harvey’s
Cleaning Service had no data in the VENDOR_ADDR record. Therefore, it
was not included in the results. We discuss including rows that do not
have a match in the lesson on outer joins.
Bank Setid
Bank_CD
Bank_Acct_Key
Pymnt_ID
Pay_Cycle
Create_Dttm
Accounting_DT
Remit_Setid
Remit_Vendor
Pay_Cycle
Accounting_Dt
Record Relationships
Before you can query against multiple records, you must first identify their
relationship and join them accordingly. Records can have one of three
different types of relationships in PeopleSoft:
Type Description
Hierarchical One record is a parent or child of another. You can
identify records with this type of relationship by looking
at the query tree on the Record Selection page. The
VENDOR and VENDOR_ADDR records are examples
of records with a hierarchical relationship, where the
VENDOR record is the parent record and the
VENDOR_ADDR record is the child record.
Related record One record is a prompt table for a field in another
record. You can identify this type of relationship by
looking at the Query page. Any fields that have a table
name on the row with the field name have a related
prompt table. The DEPTID field in the VOUCHER
record is an example of a field with a related record. It
is related to the DEPARTMENT_TBL.
No established Two records with no established relationship. The
relationship VENDOR and VOUCHER records are examples of
records with no established relationship.
Once you have identified the relationship between two records, you can
use the appropriate join to bring them together in one query.
Remember that records are joined on their common fields. When you work
with records that have an established relationship, the system
automatically joins the records for you when you select an additional table
using the hierarchical or related record option on the Join menu.
When you are working with two records with no established relationship,
you must join key fields manually. This is done by selecting both records
on the Records page and building the join logic for the common fields on
the Criteria page.
Outer Joins
The joins that you have learned about so far are called “equivalent joins.”
This means that rows of data are selected only when values for their
common fields appear in both tables. An outer join allows you to retrieve
data regardless of whether values occur in both.
Review the two tables below.
VENDOR VENDOR_TYPE
SetID Vendor_ID Name1 SetID Vendor_ID Vendor_Type
HC 00001 Elmo’s Advertising HC 00001 Advertising
MFG 00005 Discount Airlines MFG 00005 Transportation
MFG 00028 Office Depot
If you joined the above two tables using a standard any join, you would
receive the following output:
Notice that only Elmo’s Advertising and Discount Airlines appear in the
results. The reason for this is that they have an entry in both tables. Office
Depot has not been assigned a vendor type. Therefore, it was omitted
from the results.
If you joined the two records using an outer join, you would get the
following results:
Notice that Office Depot now appears in the results. The outer join tells the
system you want to see every row in each table, regardless of whether
they appear in both.
Most RDMS support outer joins and the syntax for outer joins is
RDMS-specific. Query does not support the outer join syntax for DB2,
Informix, and Microsoft SQL Server. We will not cover this type of join in
this class.
Lesson 2:
Joining Hierarchical Records
A hierarchical join is a join between a parent table and a child table. A
child table has all the same key fields as the parent plus one or more
additional fields. Therefore, these tables have an established relationship.
When you are working with two records that have an established
relationship, the process of joining them is very simple. Once you select
the tables, the system identifies the key fields and automatically links them
for you. At that point, you have access to all the fields from all the records.
VENDOR and VENDOR_ADDR are examples of parent and child tables.
The key fields for the VENDOR table are:
• SETID
• VENDOR_ID
The key fields for the VENDOR-ADDR table are:
• SETID
• VENDOR_ID
• ADDRESS_SEQ_NUM
• EFFDT
These tables have two common fields that the system joins on
automatically.
4. Click .
A list of records meeting the search criteria appears.
8. Click .
The Query page reappears with the selected record listed with
In this screen shot, the
B as the Alias.
A record is collapsed or closed, so
you cannot see its fields. The B
record is open or expanded, so
you can see its fields.
18. Click .
The new query is saved.
19. Click on the Fields tab.
The Fields page appears.
Now establish your search criteria for this query. Remember that we want
approved vendors in the state of Georgia.
26. Click .
The Fields page reappears.
27. Click .
The changes to the query are saved.
33. Click .
The Fields page reappears.
34. Click on the Criteria tab.
The new criteria row appears.
Lesson 3:
Joining Related Records
If a field in a table has a prompt table associated with it, then those two
tables have a related record relationship. Having a prompt table
associated with a field means you can pick a value from a list and the
entry is validated.
Joining related records is similar to joining hierarchical records because
the system identifies the key fields and automatically links them for you. In
a hierarchical join, the tables are joined on the common key fields. In a
related record join, the common fields may not be key fields.
Join the related record for SETID and add the description to the query.
Change the DESCR heading to identify it as the Set ID Name and position
it immediately after the set ID code.
10. Click .
The new name appears in the Heading Text column.
11. Click .
The Edit Field Ordering page appears.
12. Type 2 in the New Column field for DESCR.
13. Click OK.
The column number changes and automatically adjusts the
subsequent columns.
The query is complete. Now save the changes and run the query.
Instructions
You need a listing of all paid vouchers after 01/21/2009. The list should
identify the vendor ID and include any payment information.
Include the following fields:
Record Field
VOUCHER BUSINESS_UNIT
VENDOR_ID
PYMNT_VCHR_XREF (hierarchy join) PYMNT_ID
PAID_AMT
SCHEDULED_PAY_DT
PYMNT_HANDLING_CD
PYMNT_HNDL_TBL (related join) DESCR
Hints
9 Select the fields from the first record before clicking Hierarchy Join.
Review Questions
3. What type of relationship do records have that are joined through a Record Hierarchy
join?
4. What determines if two records can be joined via the Related Record join?
Withholding Tables
Record Name Record Description
DC_WH_CERT_CNT Contains counter numbers for withholding certificates
R
DC_WH_CODE Contains Withholding codes, percentages and
account numbers
DC_WH_ENTITY Contains Withholding Entity information
DC_WTHD_ADJUST Adjustments made to withholding after posting
process is run
DC_WTHD_DETAIL Withholding table with details for each vouchers
DC_WTHD_HDR VAT and PUC information for each voucher
DC_WTHD_RPT_TB Cosolidated reporting table that contains one row of
L data per vouchers with all withholding entries
Purchasing Tables
Record Name Record Description
PO_HDR Contains the business unit, po id, date, buyer and
other header type information
PO_LINE Contains the item id and item related information
PO_LINE_SHIP Contains the quantity and price information related to
the lines. This table should be joined with PO_LINE
to retrieve relevant information to the line items.
PO_LINE_DISTRIB Contains the chartfield distribution information related
to the PO_LINE and PO_LINE_SHIP records
Requisition Tables
Record Name Record Description
REQ_HDR Table contains the business unit, req id, date,
requestor and other header information
REQ_LINE Contains the item id and item related information
REQ_LINE_SHIP Contains the quantity and pricing information
REQ_LINE_DISTRIB Contains the chartfield distribution information for the
lines in REQ_LINE_SHIP
Receiving Tables
Record Name Record Description
RECV_HDR Contains the header information for a receipt
RECV_LN_SHIP Contains the item id, items related information, etc.
RECV_LN_DISTRIB Contains the distribution information related to the
lines.
Item Tables
Record Name Record Description
MASTER_ITEM_TBL Contains the item id,description and other information
BU_ITEMS_INV Contains the quantity information for each items
defined for a business unit
INV_ITEMS Contains more descriptive item information
ITEM_MFG Contains the manufacturer and manufacturer item id
information
PURCH_ITEM_ATTR Contains the purchasing related information for items
ITM_VENDOR Contains the priority vendor information
ITM_VENDOR_LOC Contains the vendor location information
ITM_VENDOR_MFG Contains the priority vendor manufacturer information
ITM_VNDR_UOM Contains the priority vendor unit of measure
information
ITM_VNDR_UOM_P Contains the priority vendor price information
R