127
1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

Embed Size (px)

Citation preview

Page 1: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

1

INTRODUCTION TO PEOPLESOFT

QUERY

Revised: August 2008

Page 2: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

2

OVERVIEW

• PeopleSoft Query– Basic ad hoc reporting tool– Allows you to write ad hoc queries and also run queries

shared by others– Allows data to be extracted to Excel

Page 3: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

3

BASIC QUERY

Six steps to creating a basic query

1. Select the data record(s)

2. Select the field(s)

3. Set the query criteria4. Edit the field properties (optional)

5. Save the query (optional)

6. Run the query

Page 4: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

4

SAVED QUERY

• You can access and run queries that you or others have saved in the past– Public Queries are queries that you (or others) have saved which are

accessible by anyone

– Private Queries are queries that you have saved which are only accessible by you

• When using a Public Query: – If you did not create the query: always save the query under a new name

before making any changes

– OK to Run a Public Query ‘as is’ without saving it under another name

Page 5: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

5

NAVIGATING TO QUERY: Reporting Tools > Query > Query Manager

Page 6: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

6

Using a Saved Query

• Follow along with me on this exercise• Navigate to:

Reporting Tools > Query > Query Manager

Enter EM in the “Begins with” search box

• Click on Search button

Page 7: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

7

• Note:– The list of query names & descriptions– Ownership (Public or Private)– Edit, Run to HTML, and Excel hyperlinks

Page 8: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

8

• You can open an existing query by clicking on the Edit hyperlink for the query you want to run

• Using the “Action” drop down box you can delete, move to folder, rename or copy a query to someone else

• Do NOT delete or rename a query that was created by someone else• Click on EMP_LIST_SEN_BRTH_JMS

Page 9: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

9

• This takes us to the Fields tab of the query

• We’ll take a closer look at this later

• Click the Run Tab

Page 10: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

10

Query Results:

Page 11: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

11

Wow!Wow!

• You can now format your report as you normally would with any other Excel spreadsheet, save the report or e-mail it to someone.

• Close the window

Page 12: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

12

Alternate Execution Method

•Click the HTML hyperlink for the query you want to run

Page 13: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

13

Query Results

•Note the report heading

Page 14: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

14

Creating a New Query

• Follow along with me on this exercise

• Navigate to:

- Reporting Tools > Query > Query Manager  - Click on Create New Query

Page 15: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

15

Record Selection

• The first step is to select a data record • Note the search options:

– Search By (defaults to ‘Record Name’)– Use Drop down box to see other options

• Enter Personal in the search box to find the Personal Data record

Page 16: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

16

NOTE: – Record name description– “Add Record” hyperlink to select the record for this query– “Show Fields” hyperlink to view the fields in the record– Find the PERSONAL_DATA record & click Add Record

Page 17: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

17

• Note:–Folder icon–Alias Record–Hierarchy Join–Minus Button

Fields:–Check box(es)–Key Symbol–Field names–Criteria icon–Join Record Names

Page 18: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

18

Select the Fields

• Click on the checkboxes for the following fields:– EMPLID– NAME– SEX– Birthdate

• Click on the Fields tab

Page 19: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

19

• Col • Record.Fieldname• Format • Ord• XLAT

• Agg• Heading Text• Add Criteria• Edit • Delete

NOTE the following headings:

Page 20: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

20

Edit Field Properties

• Locate the SEX field

• Select Edit

Page 21: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

21

Your edit choices:

•Heading– No Heading – Text– RFT Short– RFT Long– Heading Text – Unique Field Name

•Aggregate values

•Translate Value– None– Short– Long

Page 22: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

22

Edit the data as follows:

Heading: Text

Heading Text: Gender

Aggregate: None

Translate Value: Short

Click OK

Page 23: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

23

• Click on Reorder/Sort

• Move Birthdate to Col 3

• In the New Order By column: Make Sex sort order “1”

• Click OK

Page 24: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

24

• Note the following changes:– The Birthdate field has moved above the Sex field – The sex field is now designated as the primary sort – The short translate value will be displayed rather than a code– Column heading will show as “Gender”

• Edit a few more field properties for practice

Edit field EMPLID

Heading Text: Employee ID

Order By: 1

Page 25: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

25

• Select the View SQL tab

• The query tool automatically generates SQL (Structured Query Language) code

• SQL will look familiar to those of you who wrote queries in the past using QMF and is useful for advanced users in troubleshooting problems with a query.

Page 26: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

26

Saving Queries

• Once you have created a query, you may want to save it prior to running it.

• Click SAVE (naming standards follow)

• Enter:– Query Name– Description– Owner

• Private• Public

Page 27: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

27

Naming Standards

• Spaces & special characters are NOT allowed

• All query names should begin with “OX” followed by:– Department abbreviation (e.g. “BN” for Benefits) see PS Query Help Home

Page– Descriptive name– Initials of the person who created the query

Example:

OX_Department Abbr_Descriptive Name_Initials

OX_BN_Employee_Listing_KP

Page 28: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

28

• Enter:

Query Name: OX_GBLCO_EE_LIST_INITIALS

Description: General Info About Employees

Owner: Public• Click OK• Then click the Properties link (at bottom)

Page 29: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

29

• The “Properties” page allows you to maintain descriptive information related to the query:

– Query Name, Description and Owner defaulted from the Save Page

– Query Type defaults to User– Distinct checkbox eliminates duplicate rows

(sporadic - current problem in Oxy PS environment)

– Query Definition allows further documentation about the query

– Status Box displays the history of the last save of the query

• Click OK & then Run to execute the query

Page 30: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

30

• Examine your data• Note the “Download to Excel” option • Close this window by clicking the “XX” in the upper right corner

Page 31: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

31

Saving a query as a “favorite”

After you create your query:• Click the Return to Search button

• Enter the query name in the search box:

Page 32: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

32

Saving your query as a “favorite”

• Check the Select box• Click on the “Action” drop down arrow• Select Add to Favorites• Click GO

Page 33: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

33

Key Points

• There are six steps to creating a query:– Select the record(s) i.e. Data Tables – Select the data field(s)– Set the query criteria– Edit the field properties (optional)– Save the query (optional)– Run the query

• For translate fields, the long or short descriptions can be displayed rather than the code

• Queries can be saved as public or private

• The SQL statement generated by a query can be viewed by selecting the View SQL tab (for advanced query users)

Page 34: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

34

Individual Activity #1

You have been asked to create a query that displays the hire and termination dates of all employees and eliminate duplicates (see page 29).

Record EMPLOYMENT

Fields/Headings EMPLID Employee ID

HIRE_DT Hire Date

TERMINATION_DT Termination Date

LAST_DATE_WORKED Last Date Worked

SUPERVISOR_ID Supervisor ID

Order by TERMINATION_DT descending

Query Name HIRE_TERM_QRY

Page 35: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

35

• Did you remember to:– Change field headings– Order by termination date in decending order

• Click on the New Query hyperlink

Page 36: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

36

Individual Activity #2

You have been asked to produce an updated list of employees’ emergency contacts.

Record EMERGENCY_CNTCT

Fields/Headings EMPLID Employee ID

CONTACT_NAME Contact Name

RELATIONSHIPRelationship (short translate description)

PRIMARY_CONTACT Primary Contact

PHONE Phone

Order by EMPLID

CONTACT_NAME

Query Name EMER_CNTCTS

Page 37: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

37

• Did you remember to:– Change headings?– Use short translate value for Relationship?– Order by EmplID and Contact Name?

• Click on the New Query hyperlink

Page 38: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

38

Selection Criteria

• Next, we will add criteria rows to a query to return specific rows of data

• Compare fields to find data matching a specific selection criteria

Page 39: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

39

Selection Criteria

Create a basic query to capture employee data and save the query without running it.

Record PERSONAL_DATA

Fields NAME

EMPLID

MAR_STATUS (short description)

Order by NAME

Query Name/Description CRITERIA Criteria for Employees

Page 40: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

40

• Did you remember to make the following field edits?– Change Name to the first field and sort by name?– Use the Short Name for the Mar_Status translation type?– Name the query and give it a description?

• When you’re ready, click the Criteria tab and then the Add Criteria button.

Page 41: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

41

•Choose Expression 1 Type:

Used to specify what you are comparing• Field• Expression (i.e calculation)

NOTE:

Your selection of Expression 1 Type changes the display for Expression 1 on the right

•Expression 1:–Select the field (or Expression) you want to compare

• Field• Expression

•Next we’ll consider Condition Type

Page 42: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

42

Condition Types

Between Not between

Equal to Not equal to

Greater than Not greater than

In list Not in list

In tree Not in tree

Is null Is not null

Less than Not less than

Like Not like

Page 43: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

43

• Note the different Expression 2 Types:– Field– Expression– Constant– Prompt– Subquery

• Click the Cancel button

• Click the Query tab

Page 44: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

44

• Find the field: Sex

• Click the Add Criteria icon (funnel)

Page 45: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

45

• Select Condition Type: equal to• Expression type: Constant• Expression 2: F• Click OK

Page 46: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

46

• You can apply criteria to fields that are not included in the query output

• You need to know how the data is stored in the database to ensure accurate results when the query is run

• Click Save then Run to view the output

Page 47: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

47

RESULTS

Page 48: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

48

• In addition to your current criteria, we now want to narrow the selection to retrieve only those employees who have the capital letter “D” in their first name, middle initial or last name.

• From the Criteria tab, click the Add Criteria button

Page 49: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

49

• Select Expression 1 Type: Field

• Expression 1: Click on the Search icon

• Select Name field from the list

• Condition Type: like

• Expression 2 Type: Constant

• Expression 2: %D%

• The Like operator is case sensitive and uses wildcard characters to search for data

• Wildcard characters are:% Any string of zero or more

characters__ (underscore) Any single character

• Click OK

Page 50: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

50

•Click Save•Click Run

NOTE the Logical drop down list (And/Or) for your criteria

Page 51: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

51

You now have a female employees who have a capital “D” in their name

RESULTS

Page 52: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

52

Individual Activity #3

Produce a list of all employees whose Business Title contains the word “Manager”. Also, only show those who were hired after 1989.

Record EMPLOYMENT

Fields EMPLID

BUSINESS_TITLE

HIRE_DT

Order by HIRE_DT (descending)

Query Name/ Description Business_Title Manager Business Title Query

Page 53: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

53

Results:

NOTE: Some fields are case sensitive which will impact your results

Page 54: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

54

Criteria page

Page 55: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

55

Effective Dates

• Effective dated records are those records that contain the field EFFDT.

• The effective date provides a history of changes over time

• There are three categories of effective dates:

HistoryRows of data where the Effective Date is less than the Effective Date of the current row.

CurrentThe row of data with the highest effective date/sequence number less than or equal to today’s system date.

FutureRows of data where the Effective Date is greater than today’s system date.

Page 56: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

56

Effective Dates

• Effective Dates are used in a query as criteria to select a specific population.

• When you start a new query and select an effective-dated record/data table, a dialog box will display informing you that an effective-date criteria row has been automatically created.

Page 57: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

57

Effective Dates

• Click the New Query link

• Record: JOBCODE_TBL

• Click Add Record

• Click OK in dialog box

• Select the Criteria tab

Page 58: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

58

• Click the Edit button

Page 59: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

59

• Four effective dated comparisons:– Effective Date < – Effective Date <=– Effective Date > – Effective Date >=

• Do Not Use:– First Effective Date– Last Effective Date

Page 60: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

60

Individual Activity #4

Create a query that lists the last current job actions as of the current date for your employees.

Record JOB

Fields/Headings EMPLID ID

DEPTID (column 2) Dept ID

JOBCODE Job Code

ACTION (short description) Action

ACTION_REASON Reason

EFFDT Effective Date

LOCATION Location

ANNUAL_RT Annual Rate

Order by EMPLID

Criteria Annual salary of $50,000 or more (enter 50000)

Compensation Frequency of monthly (Enter M)

Query Name OX_BN_CUR_ACTION_XX

Page 61: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

61

Fields tab

Page 62: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

62

Criteria tab

Page 63: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

63

Results

Page 64: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

64

Using Aggregate Functions

• Five aggregate functions are available:– Average– Count– Max– Min– Sum

Page 65: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

65

Sample Aggregate Query

• Build a very simple query to list Employee IDs for employees in the PERSONAL_DATA record (or data table)

– Record: PERSONAL_DATA– Fields: EMPLID– Query Name: EMPLNUM

• Save

• Run to see how many rows are returned

Page 66: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

66

Page 67: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

67

• Now add the aggregate function to count the number of employees.– Click Fields tab– Click Edit button– Aggregate: Count– Click OK– Click Save– Click Run

Page 68: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

68

Results

NOTE: Only one row is returned with a count of the number of Employee IDs.

Page 69: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

69

Advanced Topics

–Multiple Table Queries

–Prompted Queries

–Writing Expressions

Page 70: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

70

Multiple Table Queries

• PeopleSoft Query Manager allows you to join data from more than one record/Data Table

• You can join multiple records using the web-based Query Manager

Page 71: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

71

Tables and Views

• Records listed in the Record Search may represent either a Table or a View. – A Table physically stores specific data.

– A View is a compilation of data that is usually retrieved from multiple tables. This can be considered as pre-joined tables.

– Some Views may already have criteria associated with them.

Page 72: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

72

Joins

• A join allows you to retrieve data from two or more records/Data Tables -or- specify criteria from more than one record/table

• Whenever you perform a join, the records are linked based on common fields.

• In Query, pre-defined joins can be generated as either a Hierarchical join or a Related Record join.

– You do not have to add any criteria for pre-defined joins in order to link the records.

Page 73: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

73

Types of Joins

Record Hierarch

A Hierarchical join uses records that are parents or children of each other. The hierarchical relationship is defined by the Parent Record in the Application Designer.

Example: Joining employee Personal data with Dependent/Beneficiary data.

Related Record

Related Record joins use records from non-hierarchical records/tables that are related by a common field.

Example: Description tables for common codes are related records. This relationship is determined by the Prompt Table edit defined for a field in the Application Designer.

Page 74: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

74

Join Example

Record Person_Name

Fields Emplid

Name

Create the following new Query:

Page 75: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

75

FIELDS Tab

• Return to Records Tab• Type in Job & Select the Join Record link next to the Job table

Page 76: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

76

Click on the A=Person_Name link

Page 77: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

77

• The Emplid (Key in both records) fields are automatically linked together to join the Person_Name record with the Job record

• Click on the Add Criteria because this is the join you want.

Page 78: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

78

The job record has become part of the query and is joined to the Person_Name record.

NOTE: The Alias ID for the Person_Name data table is “A” and the Alias ID for the Job data table is “B”.

Page 79: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

79

Select the following Fields from the JOB record: EMPL_STATUS, LOCATION, AND BUSINESS_UNIT

NOTE: You may have to use the Find search option

Page 80: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

80

Joining Base Tables to Control Tables

• Control tables are shared by all divisions and sometimes need to be joined using multiple keys or fields.

• Many control tables have a Setid field that is used to match the Setid for the division accessing the table.

• Most control tables also have an Effective Date that should be considered when joining to another base table.

Page 81: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

81

Many fields that have associated tables have a link next to them that allows the user to click and automatically join this table to this field.

In this example we will join the Location_Tbl control table to the Location field in the Job record.

Click on the Join LOCATION TBL link & click OK to the pre-selected join.

Page 82: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

82

Now the three tables are joined together (Person_Name, Job & Location_Tbl).

Select the DESCR Field in the Location table and go to the Criteria tab in the query.

Page 83: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

83

Here you see that the base tables have been joined together and the Effective Dates are set to look at the most current row in the record. Because you used the join link for the location table you do not see the joining of the location field in job with the location field in the control table. However, it is done automatically for you in the background. This can be seen if you look at the SQL tab.

NOTE: Because it is a control table, a manual join of the Setid should be done to eliminate the chance of duplicate values for the same field.

Page 84: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

84

Select the Criteria tab & click on the Add Criteria button to create a new criteria to join the Setid field in the Location record with the Setid for location in the Job record.

The fields to be joined are shown in the example above.

Page 85: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

85

Now we need to go to the Fields tab and edit our fields.

Page 86: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

86

• Add criteria on EMPL_STATUS to select only values of A, L, P.

• Use the short translate value for the status code.

• Move the Location Description next to the Location Code

• Rename the Location heading text to read: Location Descr

Page 87: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

87

Prompted Queries• PeopleSoft Query allows you to build reports that contain runtime prompts.

• A runtime prompt allows you or another user to enter a value for a specific field at the time the query is run.

• The report will display only those data rows that match the criteria entered in the prompt.

• This makes the query dynamic, allowing it to be used over and over again without modifying the query to meet changing requirements.

Page 88: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

88

Runtime Prompts

Record DISABILITY_BEN

Fields EMPLID

PLAN_TYPE (short description)

COVERAGE_BEGIN_DT

COVERAGE_ELECT (short description)

BENEFIT_PLAN

Order by EMPLID

Query name DISABILITY

Create the following query to retrieve employee disability election information.

Page 89: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

89

Your Fields tab should look like this.

Save the query and Run it.

Page 90: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

90

Results

Page 91: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

91

• A prompt is another type of criteria and it can be added from two locations: From either the Fields tab or the Prompts tab.

• Click the Prompts tab• The Prompts tab can be used to add runtime prompts and display a list of all prompts that

have been added to the query.• The Fields tab is the most common method of adding criteria and is useful when only adding

one runtime prompt.• Click the Fields tab

Page 92: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

92

• For field PLAN_TYPE, click the Add Criteria icon.• Expression 2 Type: Prompt• Expression 2: New Prompt

Page 93: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

93

• Select Heading Type: RFT Long

• Heading Types are:–RFT LongLong field name–RFT Short Short field name–Text Anything you want

• Type, Format and Length all default from the field definition in the database.

• Edit Types:–No table edit–Prompt Table–Translate Table–Yes/No Table

• Prompt Name is used in translations. No need to change this field.

• Click OK twice

Page 94: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

94

• Note that a prompt has been added and is represented as a bind variable.• Click Save• Click Run

Click on the Fields Tab

Page 95: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

95

• A prompt is displayed allowing you to select or enter your criteria• Select Long-Term Disability• Click OK

Page 96: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

96

By using a prompt, the query is dynamic based on the Plan_Type chosen for each run.

Page 97: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

97

• To add a prompt for an additional field, such as coverage election, you would simply add another row of criteria.

• Click the Fields tab• Click the Add Criteria icon for the COVERAGE_ELECT field

Page 98: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

98

• Choose Expression Type 2: select Prompt• Examine the Define Prompt section of Expression 2

• In Expression 2, select the New Prompt hyperlink

Prompt Will display the bind variable or prompt name used for this criteria

Search Icon Will display all prompts created for this query

New Prompt Select this hyperlink to create a new prompt to be used for this row of criteria

Edit Prompt Use this hyperlink to edit the existing prompt used for this row of criteria

Page 99: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

99

• Heading Type: RFT Long• Click OK• Click OK

Page 100: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

100

• Examine Criteria tab for new criteria row• Click Save• Click Run

Page 101: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

101

You now have two prompts that will be used in your criteria.

• Select Plan Type prompt: Long-Term Disability• Select Coverage Election prompt: Elect• Click OK

Page 102: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

102

Results

Page 103: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

103

Runtime Prompts – Example #2

Record Health_Benefit

Fields Emplid

Plan_Type Short description

Coverage_Begin_Dt

Coverage_Elect Equal to “E”

Benefit_Plan

Order By Emplid

Query Name OX_GBLCO_MEDICAL

Page 104: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

104

Your Fields tab should look like this.

Save the query and run it

Page 105: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

105

Results

Page 106: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

106

Now, we will add a prompt to the query:

Reminders:You can add a prompt in two ways:

- Using the Prompts tab - Using the Fields tab (most common method when adding one runtime prompt)

• Click on the Fields tab

Page 107: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

107

For Plan_Type: Click the Add Criteria Icon

Expression 2 Type: Prompt

Expression 2: Click New Prompt

Page 108: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

108

Select Heading Type: RFT Long

Heading Types: RFT Long (Long field name) RFT Short (Short field name) Text (Anything you want)

NOTE: Type, Format and Length all default from the field definition in the database.

Edit Types: - No Table edit - Prompt Table - Translate Table - Yes/No Table

Unique Prompt Name is used in translations No need to change this field.

Click OK twice

Page 109: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

109

Go to the Criteria tab: Note that a prompt has been added and is represented as a bind variable.

Click Save

Click Run

Page 110: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

110

A single prompt is displayed for you to select your specific criteria for the population you want to retrieve

Select Medical

Click View OK

Page 111: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

111

With the prompt, the query is dynamic based on the Plan_Type selected at run time.

Page 112: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

112

To add a prompt for an additional field, such as coverage election, (which you’ve already coded in the criteria), simply add another row of criteria.

Click the Fields tab

Click the Edit button for the Coverage_Elect field

Expression 2 Type: Prompt

Expression 2: New Prompt

Page 113: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

113

Heading Type: RFT Long

Click OK

Click OK

Examine Criteria Tab for new criteria row

Click Save

Click Run

Page 114: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

114

Select Plan Type: Medical

Select Coverage Election: Elect

Click OK

View RESULTS below.

Page 115: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

115

Prompt Summary

• Creating Prompts:

• Editing Prompts – once created, you can view them via one of the methods above

• Deleting Prompts:

To delete a prompt, access the Prompts page and click the delete button (minus sign) for the prompt you wish to delete. If you are using the prompt in a row of criteria, you must remove it from the criteria before deleting it.

Prompts Tab Useful when adding multiple prompts to one query

Criteria Tab Useful when adding only one prompt to a query for a specified field

Prompts Tab Click Edit button for the prompt you wish to edit.

Criteria Tab Click Edit Prompt hyperlink to edit the prompt.

Page 116: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

116

Writing Expressions

Record Personal Data

Fields/Headings Emplid ID

Name Employee Name

Sex Gender(short desc)

Birthdate

Page 117: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

117

Your Fields screen should look like this.

Did you remember:- To change the description of name and sex

- To add the short description to sex

Page 118: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

118

• Select the Expressions tab

• Click on Add Expression

Page 119: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

119

Change the expression Type to Number

Use 3 as the Length

Click on the Add Field Link

Choose Birthdate from the select list

Page 120: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

120

Formula (calculates age as of the current date):Datediff(mm,A.BIRTHDATE,getdate())/12

Insert/Enter the formula shown below in the Expression Text box

Click OK

Page 121: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

121

Click on the Use as Field link to include this expression to your query results

Page 122: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

122

• Change the Heading Text on the expression Line (Line 5) to “Age”

• Click on the Run tab

Page 123: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

123

Results

Page 124: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

124

Adding an Expression as Criteria in the Query

• Choose the Fields tab

• Click on the Add Criteria icon for the expression line (Line 5)

Page 125: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

125

Expression 1 Type: Expression

Expression 1: shows Expression (NO change required)

Condition Type: Greater than

Expression 2 Type: Constant

Expression 2: 35

• Click OK

• Click on the Criteria tab

Page 126: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

126

The expression is now part of the criteria.

The query will only select employees over the age of 35

Hit the Run Tab

Page 127: 1 INTRODUCTION TO PEOPLESOFT QUERY Revised: August 2008

127

Results