peoplesoft peopletools peoplesoft query · 2019. 11. 17. · 3. on records tab, search for and add...
TRANSCRIPT
7/9/2019 © SpearMC Consulting 1 © 2019 SpearMC Consulting
PeopleSoft PeopleTools
PeopleSoft Query
SpearMC Technology Course
Over 20 years of PeopleTools
PeopleTools Consultant – 13 Years
• Enhancements
• Implementations/Upgrades
• Production Support
• PeopleTools Instructor
Developer at PeopleSoft – 8 Years
• Financials Applications
• Enterprise Services Automation
• PeopleTools Reporting Technology
PeopleTools Specialties
• PeopleCode
• Web Services
• Portal Technology
• BI Publisher
• Enhancing User Experience 2
Before We Begin
Instructor – John Beretz
© 2019 SpearMC Consulting
Senior Developer and Instructor
About this course
4
About this Course
Goals – Get a sense of what PeopleSoft Query is for and what it can do for you
– Learn how to create basic Queries
– Understand what the advanced capabilities of Query can do for you
– Learn how to extend basic Queries to solve more complex problems
– Understand enough to begin your own exploration!
Overview
5
About this Course
Schedule
– End time
– Lunch break
– Frequent short breaks
During class
– Demonstrations
– Lectures
– Questions and Answers
– Hands-on activities
– Collaborative troubleshooting
– One-on-one assistance from instructor
Structure
6
About this Course
Follow along with your own soft/hard copy of the slides – To complete the activities, you’ll need to be able to flip back through
the slides
– Best way to distribute?
Ask lots of questions – If I don't know the answer, I'll find it ASAP
– Special or off-topic requests go in the ”parking lot” • We'll circle back, time permitting
My email: [email protected] – Send me comments, feedback, special requests
Tips
7
About this Course
1. What is PeopleSoft Query?
2. Query Manager Basics
3. Joins and Query Manager
4. Prompts
5. Translate Values
6. Using Expressions and Aggregate Functions
7. Effective Dating
8. Creating Left Outer Joins
9. Query Viewer, Query Scheduler, and Security
10. Scheduling Queries
Course Topics
8
About this Course
Name
Team and Role
PeopleSoft experience
Other relevant technical experience?
How do you expect to use what you learn in this class?
Any special topics you’d like covered?
Introduce yourself!
© 2019 SpearMC Consulting
Introducing PeopleSoft Query
Introducing PeopleSoft Query
In common usage: a “query” = a question
In Information Technology: a “query” = a question asked of a database – Request to pull specific information from a database
– For relational databases, typically defined using programming language SQL (Structured Query Language)
A query against a relational database includes: – Tables: What kinds of things are you interested in?
• E.g. Purchase Orders, Employees
– Field/Column list: What specific pieces of data should be included? • E.g. Purchase Order Line Item quantity, and price
• Some of these might actually be calculations involving multiple pieces of data
– Criteria/Filters: Which set of things do you want to get data about? • E.g. All Purchase Orders issued last quarter
– Groupings/Aggregates: How to summarize across individual items? • E.g. The total cost per Purchase Order, regardless of individual line items
What is a Query?
10
Introducing PeopleSoft Query
PeopleSoft Query is a set of delivered tools that enables users to query data stored in PeopleSoft
– Does not require knowledge of SQL – Allows you to answer questions about data in the PeopleSoft system much
more quickly than flipping through a bunch of pages! – A query created and managed by these tools is referred to as A PeopleSoft
Query
There are 3 components to PeopleSoft Query: – Query Manager
• Tool used to create and run a Query
– Query Viewer • Tool used to run an existing Query and view the results • Ideal for users who don’t have the ability to create their own Queries
– Query Scheduler • Tool used to schedule an existing Query to run at a designated time and
distribute the output
What is PeopleSoft Query?
11
Introducing PeopleSoft Query
Why can Query do for me? – Answer questions on an ad-hoc basis
– Create and save useful, simple “reports” that you can run periodically and share with others
– Grab data that can then feed other PeopleSoft technologies (e.g. BI Publisher)
Demo: What does a simple PeopleSoft Query look like?
What is PeopleSoft Query?
12
Introducing PeopleSoft Query
All information in all PeopleSoft applications (e.g. Purchase Orders, Employees, Inventory) is stored in a relational database
What’s a Relational Database? – A structured collection of information that is related to a particular
subject or purpose
– A database is analogous to an Excel workbook
Data can be easily retrieved and summarized using SQL – This manipulation can produce useful reports.
PeopleSoft and Relational Databases
13
Introducing PeopleSoft Query
Within a relational database, data is organized into storage containers called tables
What’s a Table? – Each table is designed to store information about a specific type of item
– Made up of columns and rows
– Each item in a table is stored in its own row • Example: Each row in an invoice table stores the data of one invoice
– Columns represent individual data fields stored for the type of item • Example: Each column of an customer table is for storing a different piece
of information about a customer (name, contact, address, etc.)
• Each column on a table can only stored one type of data (e.g. number, text, date)
– A table is analogous to a sheet in an Excel workbook
PeopleSoft and Tables
14
Introducing PeopleSoft Query
In PeopleSoft, tables are often referred to as Records
In PeopleSoft, columns are often referred to as Fields
What does the word “Record” mean to you? – All the data you have on something, i.e. an “employee record”?
– This is NOT what it means in PeopleSoft!
PeopleSoft Records
15
Introducing PeopleSoft Query
Keys are fields in tables that are used to uniquely identify a row – No two rows in a table have the same key values
– Examples: Sales Order Number, Purchase Order Number, Employee ID
A key for a table can be a single field or multiple fields – Multiple field keys are common in PeopleSoft Records
– Examples: • Employee ID + Employee Record
• Business Unit + Sales Order Number
• SetID + Item Number
• SetID + Supplier ID + Address ID + Effective Date
Fields and Keys
16
Query Manager Basics
18
Query Manager Basics
1. Creating a Simple Query
2. Changing Field Headings
3. Removing a Field
4. Changing Field/Column Position
5. Changing Results Sort Order
6. Query Criteria Essentials
Topics
© 2019 SpearMC Consulting
19
Query Manager Basics
Everyone in the class will be doing the same activities in the same PeopleSoft environment
– We need a way to avoid “stepping on each other”!
Naming conventions – All custom objects will start with “Z”
– Choose a unique 2-character identifier (represented by “XX” in examples), preferably your “magic number” or your initials; I’ll use “ZZ”
– Our custom objects will all have a ZXX prefix (mine will use “ZZZ”)
– Shared custom objects will start with just “Z_”
Housekeeping
Query Manager Basics
Creating a simple Query is easy! 1. Open Reporting Tools > Query > Query Manager 2. Click Create New Query 3. On Records tab, Search for and Add a Record (FROM table) 4. On Query tab, mark checkboxes next to Fields to include in the result set 5. Run it! Select Run tab 6. Save it
• Click Save button at lower left of all tabs except Run • Name it • Accept default values for other fields
Demo: Creating a Simple Query – Creating a new Query – Choosing columns – Saving the Query
Creating a Simple Query
20
21
Query Manager Basics
1. Login to PeopleSoft.
2. Navigate to Reporting Tools > Query > Query Manager
3. Click on the Create New Query link
4. In the Record Name field, enter the first few letters of the name of the Record you want to use and click on the Search button. – Records matching the criteria appear listed as RecordName - RecordDescription
5. In the search results, click on the Add Record link beside the Record you want to use. – Click OK if you see a message about ”effective date”
6. Check the boxes next to the fields you’re interested in or click the Check All button
7. Click on the Save button at the bottom of the page.
8. Enter a unique Query name (all caps, numbers, “_”, and “-”)
9. Enter a description
10. Set Owner to Public (others can use) or leave it Private (only you can use)
11. Click OK.
12. Click the Run tab at the top-right of the page.
Creating a Simple Query
© 2019 SpearMC Consulting
Query Manager Basics
The Record behind the Job Data app is known as the Job Record – Navigation to Job Data: Workforce Administration > Job Information > Job
Data – All data you see in the Job Data application is stored in the Job Record
The master Record for – Organizational information (e.g. Business Unit, Company, Department, Pay
Group) – Employee Life-Cycle Events (e.g. Hire, Termination, Transfer, Pay Rate
Change) – Job and Salary Information (e.g. Job Code, FLSA Category, Full/Part-Time,
Hourly Rate, Annual Rate, etc.)
Actual Record name = JOB
Job Record Key includes Fields: – Employee ID (EMPLID): Unique ID assigned to a person – Employee Record (EMPL_RCD): Unique number, starting with zero,
assigned to each relationship that person has with the organization
Meet the Job Record
22
23
Query Manager Basics
Activity: Create a Simple Query Over JOB 1. Use the Job Record (JOB)
2. Include the following fields:
3. Name the Query ZXX_JOB1
4. Give it a description that includes your name
5. Make it Public
6. Run it!
Creating a Simple Query
© 2019 SpearMC Consulting
• EMPLID • EMPL_RCD • EFFDT • EFFSEQ • DEPTID • JOBCODE • SUPERVISOR_ID • HR_STATUS • EMPL_STATUS
• LOCATION • FULL_PART_TIME • EMPL_TYPE • STD_HOURS • EMPL_CLASS • GRADE • HIRE_DT
Query Manager Basics
Changing Field Headings 1. On Field tab, click Edit button next to Field to change
2. Select Heading type of “Text”
3. Change Heading Text to desired column label
Removing a Field – On Field tab, click “minus” button at far right of Field to remove
– Alternative Method: Return to Query tab, find Field to remove, and uncheck it
Demo: Field Basics – Changing headings and removing fields
Query Manager Field Basics
24
Query Manager Basics
Activity: Field Basics – Change the label of Field STD_HOURS from "Stnd Hrs/Wk" to "Weekly
Hours”
– Remove field EFFSEQ from the Query results
– Test it!
Query Manager Field Basics
25
Query Manager Basics
Changing Result Column Left-to-Right Order 1. On Field tab, click Reorder/Sort button 2. Enter new position, as a number, in New Column field 3. Click OK button
Changing Sort Order of Result Rows 1. On Field tab, click Reorder/Sort button 2. Enter ”1” in the New Order By field next to the Field to sort by 3. Enter “2” for secondary sort Field, etc. 4. Mark the Descending checkbox to sort in reverse order 5. Click OK button
Demo: Field Position and Sort – Changing the position of the results columns – Changing the sort order of the result rows
Query Manager Field Basics
26
Query Manager Basics
Activity: Field Position and Sort Modify your Job Data Query so that it’s sorted by Start Date within a location. Also, move the supervisor ID to the last column of the results. – Move Field SUPERVISOR_ID to the last position – Don’t move the Start Date (HIRE_DT) field – Sort the Query results by
1. LOCATION 2. HIRE_DT 3. EMPLID 4. EMPL_RCD
– Tip: The order of the columns after this activity should be: 1. LOCATION 2. EMPLID 3. EMPL_RCD
…
14. HIRE_DT 15. SUPERVISOR_ID
Query Manager Field Basics
27
Query Manager Basics
Adding Criteria to Query definitions filters the rows that come back
Most criteria have form Expression1 ConditionType Expression2
Adding criteria to a Query 1. Open either the Query or Fields tab 2. Click the Add Criteria icon next to the Field to filter on
• The “Edit Criteria Properties” page opens • Expression 1 will already be set to the Field
3. Choose the Condition Type • E.g. equal to, not equal to, greater than, less than
4. Choose a Type for Expression 2 1. E.g. a Constant value, another Field, a calculation (Expression)
5. Enter the details for Expression 2 (depending on the selected type) 1. E.g. the Constant value, the other Field, the Expression calculation
6. Click OK
Demo: Query Criteria – Field equal to Constant, in a list of values, between values
Query Criteria Essentials
28
Query Manager Basics
Activity: Filtering Data Modify your Job Data Query so that it only returns
– Active employees (EMPL_STATUS=A)
– Employees hired between 2000 and 2017 (HIRE_DT)
– Employees in departments 10000 (HR), 10200 (Headquarters), 11000 (IS), 13000 (Finance)
– Test it!
Query Criteria Essentials
29
Query Manager Basics
Effective Dating is a PeopleSoft feature that: – Allows data to change over time without losing history
– Supports “future dating” data: you can make a change that won’t become effective until some point in the future
Each row in an Effective Dated Record has an Effective Date – Represents the date the row of data became (or will become) valid
Many Records in PeopleSoft utilize Effective Dating – A Record is “Effective Dated” if Field EFFDT is part of the key
How does it work? – Instead of changing the value in a field, insert a new copy of the row
but with EFFDT = current date
– Make the changes to the new row; don’t change the old one
Introducing Effective Dates
30
Query Manager Basics
Example: JOB Record
Effective Dated Rows
EMPLID EFFDT EFFSEQ
1 01/01/2011 0
1 01/01/1988 0
2 01/01/2019 0
2 01/01/2005 0
2 01/01/2001 0
3 06/01/2019 0
3 06/01/2019 1
3 12/31/2019 0
history
current
history
current
future
current
history
future
31
Query Manager Basics
“Include History” Option – By default, no history is displayed to users
• i.e. only current and future effective dated rows – To view history, click Include History in Component button bar
• History rows will appear • Only an option for user with Action Update/Display All permission
“Correction Mode” – By default, users cannot edit data with a past Effective Date
• They must add a new Effective Dated row • Enforces compliance with maintaining data history
– Click Correct History button on Component button bar to override • Turns on Correction Mode • Intended for use correcting typos • Only available for users with Action Correction permission
Demo: Using Effective Dates in PeopleSoft Applications – Adding effective dated rows – Include History – Correction Mode
Effective Dates in Applications
32
33
Query Manager Basics
Historical data, current data, and future data are all stored in the same table
If a Query doesn’t handle Effective Dating, it may return multiple rows of data when you expected only one
– E.g. Instead of one row per employee you may get multiple rows for each employee
Query Manager automatically creates criteria to only include current rows
– You must manually remove this criteria if you want to see all rows (historical and future)
Effective Dates and Query
© 2019 SpearMC Consulting
Query Manager Basics
Demo: Effective Date Criteria – Criteria line item automatically added when Query was created
Activity: JOB and Effective Dates 1. Save Query
2. Run Query
3. Note how many rows there are
4. Remove effective dating criteria
5. How many rows now?
6. Restore effective date criteria, either by manually re-adding it or reloading saved Query
Effective Dates and Query
34
Query Manager and Joins
Query Manager and Joins
Databases are designed to reduce data redundancy – Goal: store each piece of information in as few tables as possible
– Easier maintenance (fewer places data needs to be updated)
– Saves disk space
Relationships between tables give you away to “hop” between tables
– Relationships are defined by including the key fields of one table on another
– This way, only the keys must appear on multiple tables, not the actual data
– To preserve these relationships, values in key values don’t change • Referred to as preserving “data integrity”
Keys and Relationships
36
Query Manager and Joins
Example – Each Employee is assigned to a Location
– Each Department exists within a Location
– We sometimes need the Location Name in both situations
– Should we store the name of each Location on each table?
Keys and Relationships
Employee ID 🔑
Location ID Location Name
5001 100 Desert Rose HS
5002 200 Variety Secondary
5003 400 Sandy Valley MS
5004 100 Desert Rose HS
Department ID 🔑
Location ID Location Name
A0010 400 Sandy Valley MS
A0020 400 Sandy Valley MS
A0030 200 Variety Secondary
B0010 100 Desert Rose HS
Job Table Department Table
37
Example (continued) – Instead, only store the Location ID and lookup the Location Name on
the Location table using the Location ID!
Query Manager and Joins
Keys and Relationships
Location ID 🔑 Location Name
100 Desert Rose HS
200 Variety Secondary
400 Sandy Valley MS
Employee ID 🔑
Location ID
5001 100
5002 200
5003 400
5004 100
Department ID 🔑
Location ID
A0010 400
A0020 400
A0030 200
B0010 100
Jo
b T
ab
le
De
pa
rtme
nt T
ab
le
Location Table
38
Query Manager and Joins
A means for combining fields from two tables into a single Query by using Fields common to each
– Use table keys as a means to ‘relate’ one table to another.
Records in a Join are often referenced by their Alias – Automatically assigned “nickname” of “A”, ”B”, “C”, etc. – Fields in a Query are referred to by Alias.FieldName
How does it work? – Query compares each row of Table A with each row of Table B to find all
pairs of rows which satisfy a join condition (e.g. same value in both places)
– When join condition met, rows from A and B are combined into a single result row
What’s a Join?
39
Query Manager and Joins
Employee ID Location Description
5001 100 Desert Rose HS
5002 200 Variety Secondary
5003 400 Sandy Valley MS
5004 100 Desert Rose HS
What’s a Join?
LOCATION 🔑 DESCR
100 Desert Rose HS
200 Variety Secondary
400 Sandy Valley MS
EMPLID 🔑 LOCATION
5001 100
5002 200
5003 400
5004 100
LOCATION_TBL JOB
Query Results
Join on
LOCATION
40
Query Manager and Joins
What’s a Lookup Relationship? – Between a “main” table and a “lookup” table
– Rows on main table store the keys of the lookup table
– Additional fields can be “looked up” on the lookup table using the key value stored on the main table
– Example: From the Department table, looking up the description associated with each department’s location
A Lookup Join is used between two tables that have a “lookup” relationship
Lookup Relationships and Joins
41
Query Manager and Joins
Automatic Lookup Join – In the Fields area of the Query Tab, PeopleSoft sometimes suggests joins to
related “lookup” Records by displaying Join… links
– Suggested Record is typically a “valid values” table containing descriptive information related to system codes (e.g. Category Names, Group Names)
– Clicking one of the links automatically joins to that Record
– When prompted with Select join type, just click OK (for now!)
Demo: Automatic Lookup Joins – Accepting one of Query Manager’s suggested joins
Automatic Lookup Joins
42
Query Manager and Joins
Activity: Defining Automatic Lookup Joins Modify the Job Listing Query results to include a description of the most recent action taken by HR for each employee.
– The Action Code of the most recent HR action is stored in JOB.ACTION
– ACTION_TBL is the standard lookup table for Action Codes
– ACTION_TBL.ACTION_DESCR stores the description of an Action Code
– Set the result column heading label to “Action Taken”
– Position the result column immediately to the left of “HR Status”
Automatic Lookup Joins
43
Query Manager and Joins
Activity: Defining Automatic Lookup Joins, part 2 Modify the Job Listing Query results to include a description of the reason for the action taken by HR. – The Action Reason Code of the most recent HR action is stored in
JOB.ACTION_REASON – ACTN_REASON_TBL is the standard lookup table for Action Reason
Codes – ACTN_REASON_TBL.DESCR stores the description of an Action Reason
Code – Set the result column heading label to “Action Reason” – Position the result column immediately to the right of the Action Taken
column – Test it!
How many result rows came back? What happened?
Automatic Lookup Joins
44
45
Query Manager and Joins
Joins may cause result rows to get filtered out of the results! – In Standard Joins, rows in the main table that don’t have a matching
row in the target table are dropped from the results
– Standard joins are also known as Inner Joins
– Don’t want rows to get dropped? Use Outer Joins
When prompted by Query Manager with Select join type: – Choose “Join to filter…” if you want rows dropped from the results if
there’s no corresponding row in the target table
– Choose “Join to get additional fields” if you don’t want rows dropped from your results (usually best option for lookups)
Joins and Data Filtering
© 2019 SpearMC Consulting
Query Manager and Joins
Activity: Defining Automatic Lookup Joins, part 3 Modify the Job Listing Query results to include a description of the reason for the action taken by HR. For employees without an action reason, leave the description blank.
1. Remove table ACTN_REASON_TBL from the Query
2. Repeat the previous activity, but this time, use a “Left outer join” instead of a “Standard Join”
3. Test it! • Did the new join cause rows to get filtered from the results?
Lookup Joins in Query Manager
46
47
Query Manager and Joins
What’s a Parent-Child Relationship? – A relationship between two tables in a database
– Each row on the parent table “owns” potentially many rows on the child table
– Each row on the child table represents something that “belongs to” a parent row
Child tables – Have same key field(s) as parent, plus at least one more
– The child is completely dependent on the parent, i.e. if you delete the parent row, you should also delete the child rows
Also known as hierarchical relationships – Child tables can have children of their own
– Hierarchies can become very complicated!
Parent-Child Relationships
© 2019 SpearMC Consulting
48
Query Manager and Joins
Example – PERSON: One row for each employee (and non-employee)
• PERSONAL_PHONE: One row for each person’s phone number
• ADDRESSES: One row for each address a person has
Parent-Child Relationships
© 2019 SpearMC Consulting
49
Query Manager and Joins
Automatic Parent-Child Join – Available via Hierarchy Join links on Query tab (to right of Record
names)
– Click link to display diagram of related parent/child Records
– Clicking one of the Records automatically adds join to that Record
– The Records you get to choose from are limited to those with parent-child relationships explicitly defined in the database
• Don’t see the Record you’re looking for? You’ll need to use the manual join technique (more ahead)!
– Only standard joins are used, not outer joins • If you need an outer join, you’ll have to do a manual join
Demo: The Hierarchy Join feature – Joining to a Record listed in the Query Manager Record hierarchy
Automatic Hierarchical Joins
© 2019 SpearMC Consulting
Query Manager and Joins
Activity: Defining Automatic Hierarchical Joins Modify the Job Listing Query results to include the compensation rate and frequency.
– Compensation Rate and Compensation Frequency can be found on Record COMPENSATION, which is a child of JOB
– Compensation Rate is stored in COMPENSATION.COMPRATE
– Compensation Frequency is stored in COMPENSATION.COMP_FREQUENCY
– Display the Compensation Frequency as a description instead of a code
Automatic Hierarchical Joins
50
Overachiever
51
Query Manager and Joins
Joins can be defined “manually” using Query Manager
Manual Joins require an understanding of the Data Model – i.e. the relationships between Records, and which Fields are used to
store key values that preserve those relationships
Defining a join manually 1. Find Record to Join using Records tab
2. Click Add Record link to right of Record name
3. Choose join type
4. Choose which Record (already in the Query) you want to join to
5. In the Auto Join Criteria popup, accept or reject the suggested Fields • These are Query Manager’s guesses based on like-named fields, but they
are often wrong because they are based on like-named fields!
6. Add additional join criteria manually, as needed
Defining Joins Manually
© 2019 SpearMC Consulting
52
Query Manager and Joins
When defining join criteria for an outer join, you must designate the criteria as being part of an outer join, not just another filter
– You MUST choose outer join at the time you add the Record • Forgot to do this? Delete the Record from the Query and re-add it!
– On Edit Criteria Properties page, set This criteria belongs to = “ON clause of outer join X”
• “X” should be the alias of the table you’re outer-joining to
• If you don’t do this you will get a SQL error when you run the Query
Demo: Manually joining a Record – Adding a Record to an existing Query – Adding Criteria necessary to define the join
Defining Joins Manually
© 2019 SpearMC Consulting
Query Manager and Joins
Activity: Defining Joins Manually Modify the Job Listing Query results to include the name of the employees’ supervisor, where applicable.
– JOB.SUPERVISOR_ID contains the Employee ID of the employees’ supervisor.
– Current employee name is stored in PERSONAL_DATA.NAME.
– Display the supervisor name to the right of the supervisor’s ID in the results.
Defining Joins Manually
53
Doing More With Query
© 2019 – SpearMC Consulting
55
1. Translate Values
2. Prompts and Wildcards
3. Expressions and Meta-SQL
4. Aggregate Functions
5. Distinct
Doing More With Query – Topics
© 2019 – SpearMC Consulting
56
There are many fields in PeopleSoft records that use “codes” as values
rather than user friendly descriptions
– E.g. Asset Type = “03”, Vendor Type = “GEN”
These codes can be confusing and often have no meaning to the user
For some Fields, you can modify Query Field properties to show the
“translation” of the codes, i.e. their description instead of the actual
stored value
Examples
– E.g. Asset Type “03” translates to “Real Estate”
– Vendor Type “GEN” translates to “One Time”
Translates have both a long and short description
Which fields in your Query use Translate Values?
– Look for a value in the XLAT column on the Filed tab
Demo: Displaying Translate Descriptions
– Configuring Translate fields to display descriptions in results
Translate Values
© 2019 – SpearMC Consulting
57
Activity: Display Translate Field Descriptions in Results
Display descriptions for result columns “HR Status” and “Pay Status”, not codes.
– Display HR_STATUS as a long Translate description
– Display EMPL_STATUS as a long Translate description
– Test!
Translate Values
58
Allows the user to enter criteria values at runtime
Can prompt on any field type – Character, Numeric, Date/Time, Yes/No Fields
Created from the Prompts tab and added as a criteria value
By default, all criteria are used, even if user leaves prompt blank! – By default, Query Prompts are required, i.e. user cannot leave them
blank
– Set prompt to “optional” to skip criteria when no prompt values provided (available as of PeopleTools 8.54)
Query Prompts
© 2019 SpearMC Consulting
© 2019 – SpearMC Consulting
59
What’s a Wildcard?
– Special character used with the LIKE criteria condition type
– Used to define a pattern that matches multiple values instead of a single value
– Standard wildcard symbols
• “%” = any text, i.e. when the user enters a ‘%’ symbol in a query prompt, the Query will
assume “any value” for the condition where the prompt is used
• “_” = any single character
How do wildcards work with Query Prompts?
– Wildcard characters can be entered by user if prompt is used in LIKE criteria
– Equivalent to user entering all prompt values that match the pattern
– Only works if prompt criteria defined using Like condition (rather than Equal To)
Demo: Adding Prompts to a Query
– Defining Prompts
– Defining Criteria that use Prompts
Prompts and Wildcards
© 2019 – SpearMC Consulting
60
Activity: Adding Prompts to a Query
Limit the Query results based on a user specified Location. If the user doesn’t specify
a Location value, return all Locations.
– Add appropriate criteria and prompt on JOB.LOCATION
– Don’t provide a lookup on the Location prompt
– Allow the user to specify multiple Locations via wildcards
– Test!
Activity: Adding Prompts to a Query, part 2
Instead of limit the Query results based on a harcoded set of departments, let the user
specify a department when they run the Query. Let the user choose the Department
from a lookup. If the user doesn’t specify a Department value, return all Departments.
– Add appropriate criteria and prompt on JOB.DEPTID
– Provide a lookup on the DEPTID prompt using Record SET_DEPT_VW
Prompts and Query Manager
© 2019 – SpearMC Consulting
61
Expressions enable you to manipulate the data in your query to create
“fields” that do not exist as actual fields in your tables/records
How can I use Expressions?
– As new columns in Query results
– As “fields” for use as either “left” or “right” side of criteria
Syntax identical to SQL
– Numerical - +, -, /, *
– Text Manipulation – Substring, Concatenate
– Date – Add and subtract Date values
Demo: Adding Expressions to a Query
Query Expressions
62
Expressions can include values entered by the user in Prompts
Activity: Adding a Numeric Expression as a Field – Create an optional Prompt on Field TAX_RATE
– Define an Expression that multiplies JOB.COMPRATE by the amount entered by the user
• Use Length = 8 and Decimals = 2
– Display the Expression in a Query results column labeled “Comp Tax”
– Test!
Expressions and Prompts
© 2019 SpearMC Consulting
63
What’s Meta-SQL? – PeopleSoft Proprietary syntax that can be incorporated into Query
Expressions – Gets “resolved” into real SQL at runtime – Always prefixed with % – Sometimes in the form of a function, i.e. %metaSqlName(parameters)
Meta-SQL handles platform differences, e.g.: – %CurrentDateIn: The current date – %Concat: String concatenation operator – %DateDiff(fromDate, toDate): Number of days between two dates – %Round: Rounds a decimal number – %Substring: Gets a substring of a string – %Upper: Converts string to uppercase
Expressions and Meta-SQL
64
Want to learn more? – Check out PeopleBooks (PeopleSoft Hosted Online Help)
• PeopleTools > Development Tools > PeopleCode Language Reference > Meta-SQL Elements
– Which Meta-SQL syntax is valid for PeopleSoft Query? • See section Meta-SQL Placement Considerations
Expressions and Meta-SQL
65
Activity: String Expressions and Meta-SQL – Combine supervisor name and ID into single Query result column
– Hint: Use %Concat
Activity: Date Calculations in Expressions – Add a “Years of Service” column to the Query results
– Hint: Use %DateDiff and %CurrentDateIn
Expressions and Meta-SQL
© 2019 SpearMC Consulting
© 2019 – SpearMC Consulting
66
Aggregate Functions enable you to do math across result rows!
Aggregate functions are turned on for individual Fields
– Use Fields tab Edit button
Functions available:
– Sum
– Count and Count Distinct
– Average
– Minimum
– Maximum
Result rows with identical values in the Fields w/o Aggregate function
are combined
Demo: Using Aggregate Functions
– Defining aggregate functions in Query Manager
Aggregate Functions
67
Activity: MIN and MAX – Create a new Query based on Record.JOB
– In the results, list the most recent hire date and the first hire date for each location
– Name the Query ZXX_LOC_HIRE_DTS
Activity: COUNT DISTINCT – Create a new Query based on Record.JOB
– In the results, list the number of unique Job Codes associated with each Department
– Name the Query ZXX_DEP_JOB_CODES
Aggregate Functions
© 2019 SpearMC Consulting
68
Typically, duplicate result rows are not helpful
Using an aggregate function eliminates duplicates – Duplicate rows are “rolled-up”
Alternative: Set the Query to Distinct – Duplicate rows are dropped from resultsnique rows
– Properties (link at bottom of page) > Distinct
Demo: Suppressing duplicates – Distinct vs. Count
Eliminating Duplicate Rows
© 2019 SpearMC Consulting
Beyond Query Manager
70
Beyond Query Manager
Access to Records in Query Manager – Users can only Query Records they have security to
– Records are grouped into Access Groups
– Users have permission to Access Groups: User Profile > Role > Permission List > Access Groups
Query Profiles – Define special PS Query usage restrictions on groups of users via
Permission Lists
Data/Row Level Security – PeopleSoft HCM has sophisticated data security managed by admin
– Used by both applications and Query
– Managed via Set Up HCM > Security
– Driven by set of delivered security views associated with Records in Application Designer
Query Security
© 2019 SpearMC Consulting
Beyond Query Manager
Query Search – Search for public or private queries based on multiple search criteria
Run Query and Export results to Excel or HTML – Queries can be run and the results exported to various file formats
Add a Query to Favorites – Maintain a list of frequently run queries
– In Query Viewer search results, click Favorites link at far right
– Your favorite Queries always appear on Query Viewer main page
Query Viewer
71
Beyond Query Manager
Use Query like a reporting tool! – Queries can be scheduled to run periodically
– Query output can be distributed via Report Manager
– Data is not live – it’s point-in-time
– File formats include PDF and HTML
Navigation is Reporting Tools > Query > Schedule Query – Create a new Run Control ID or use an existing one
Query Scheduler
© 2019 SpearMC Consulting
72
Beyond Query Manager
1. Search for and select a Query Name.
2. Description: Defaults to Query’s description (if there is one)
3. Click the Run button. You are presented with Process Scheduler Request dialog.
Schedule Query Page
© 2019 SpearMC Consulting
73
Beyond Query Manager
Change the format to an acceptable format (HTM or PDF recommended)
You may optionally include others to be distributed output, either in an email or in the report repository (Report Manager).
Click OK to run Query
Process Scheduler Request
© 2019 SpearMC Consulting
74
Beyond Query Manager
HTM – Optimized for browser viewing (HTML document)
– Similar to standard Query Manager output
– Best for viewing online
– Best for Drilling URLs
PDF – A minimally formatted PDF file
– Useful for offline viewing (i.e. saving a copy)
XLS – Excel document
– similar to Query’s Download to Excel feature
– Excellent if users want to “play” with the data in Excel
Useful Output Formats
© 2019 SpearMC Consulting
75
Beyond Query Manager
TXT – Plain text file in in CSV format (Comma Separated Values)
– No support for Drilling URLs
XFORM – “Transformed” XML
– Used in conjunction with Query Manager Transformations tab and XSLT
XML – WebRowSet format: XML standard used for data exchange between
systems, especially Java-based systems
– No support for Drilling URLs
XMLP – Same XML you get from Download to XML link
– Intended for use with BI Publisher
Special-Purpose Output Formats
© 2019 SpearMC Consulting
76
Beyond Query Manager
Use to check the status of the Query (is it done yet?)
From the Schedule Query page, note your Query’s Process Instance number and click the Process Monitor link
Your Query appears in Process List – Look for the row with your Process Instance in the Instance column and
your User ID in the User column
Query is finished running when Run Status is “Success” – Click Refresh button to update the status
Click Go back to Schedule Query to exit
Using the Process Monitor
© 2019 SpearMC Consulting
77
Beyond Query Manager
Example
Using the Process Monitor
© 2019 SpearMC Consulting
78
Beyond Query Manager
When distributed via Role or User ID, the reports are available within Report Manager
– Navigation: Report Manager link on Schedule Query page, or Reporting Tools > Report Manager).
The description of the Query is used to identify the output
Accessing the Report
© 2019 SpearMC Consulting
79
Beyond Query Manager
When clicking the report link description the report renders with any Drilling URLs active
Query Report Output
© 2019 SpearMC Consulting
80
www.SpearMC.com