HCM 2021 Query Builder Getting Started Guide
HCM 2021 Query Builder Getting Started Guide
Please have the following information at hand before you contact a PSE representative:
l Your customer number.
l A listing of any Epicor HCM modules or service packs that you have installed.
l A clear summary of the problem. Identify it specifically, especially in doc-
umentation that your organization can use later. Write down each step you
took when you found the problem (take screen prints, if possible).
l Any specific error messages you encountered.
Table of Contents
About This Guide vii
This guide helps you understand the basic building blocks and concepts
behind the Epicor HCM Query Builder.
- vii -
Preface
- viii -
About This Guide
Epicor HCM has an extensive online help facility to assist you when you need
help. You can access online help in Epicor HCM by clicking the Help button
that is in the product. If you are in a task when invoking help, the help topic
for the task that you are viewing appears.
Each procedural help topic in the Epicor HCM online help provides systematic
instructions that guide a user through completing a task. Once the online
help is open, you can navigate to other areas in the help system. You can
search for other procedures through the Contents, Index or by using the
built-in Search functionality.
While Epicor HCM is very intuitive to use, there may be certain fields in a task
that are more difficult to work with or remember their purpose. Epicor HCM
has a Field Level Help system, where some key fields have been singled out
for quick access to information. Anywhere you see a question mark icon
you can click it to display an informational box. The information presented is
intended to assist you in completing that field and therefore to finish the
task. If you need further assistance, the full online help system is always avail-
able.
For more information about Microsoft Windows, choose Help and Support
from the Start menu.
Use Microsoft Internet Explorer Help for assistance with issues specific to
Internet Explorer. To view Microsoft Internet Explorer Help, from the Menu
bar click Help > Internet Explorer Help or press F1 on your keyboard.
- ix -
Preface
-x-
Chapter 1
Epicor HCM | 1
Chapter: 1
Query Builder
Query Builder provides access to the Epicor HCM database from the user
interface.
Types of Queries
Part of the power of Epicor HCM is that it puts you in complete control of
your human resources data. The Query Builder tool enhances that control by
giving you the ability to create customized snapshots of your HR data.
The Query Builder allows you to easily create these queries. No technical
expertise is necessary to create powerful queries that give you deep insight
to your HR data.
Find the Query Builder on the Reports menu, and then navigate to Ad Hoc
Query Builder.
Query Builder opens in a new browser window. To start a new report, from
the File menu, select New, and then select one of the following query types.
Query Type Description
Person Query Person queries are the most common query option. They cre-
ate a query that starts with the tPerson table and returns data
about the people in your Epicor HCM database. For example,
use a person query to create a query listing employees’ cur-
rent job title, department and annual salary.
To ensure row security, a person query always includes the
PersonGUID field; this field must be a part of your query.
Table Query Use a table query to build a query that begins with a table
other than the tPerson table. For example, you could use this
menu item to build a that lists benefit plan data or requisition
data. When designing a query from a non-person table, you
have access to superviews and previously created queries
saved as views for use in your query. You cannot, however,
use a tPerson table.
SQL Query Use a SQL query to create a query from scratch, manually
entering SQL code. This query type is for advanced users who
have an intimate understanding of SQL and the Epicor HCM
database. This option is available only to people assigned to
the Query Builder administrator role.
Row Security Query Use a row security query to select a specific set of people to
whom you want a security group to have access, and then use
Epicor HCM | 3
Chapter: 1
Once you select the type of query to create, you are prompted to enter addi-
tional information about the query, including the name of the query and a
description. You are also prompted to select query options, such as filtering
to current history records, filtering to active employees only, and sharing the
query. If your Epicor HCM system is licensed for the Position Control module,
you can also opt to have the system automatically select the employees'
primary position.
You can change these query properties at any time from the File menu by
selecting Properties. Upon entering query information, the Query Builder
opens the Designer tab.
Before creating a query, become familiar with the following areas of the
Query Builder.
Designer Tab
The Designer tab is a graphical user interface, allowing you to design quer-
ies.Use the Designer tab to add fields to a query, include tables in the query,
manage table joins, and add criteria to a query.
Add Fields
To add a field from a table to your query, select the check box next to the
field you want to add. The fields that you add to the query display on the
Fields tab at the bottom of the form. Use the Fields tab to change field
information:
n Use the Alias field to change the display name for the field. The alias
you enter displays as the column header on the Results tab.
For example, you might want to change the display name of Full
Name to Employee Name to describe the data that is returned.
n Use the Sort Order field to change how the query sorts the results:
Ascending, Descending, or None.
n Use the Filtered field to apply on-the-fly criteria on the Results tab. If
you select true in the filtering for a field, when you open the Results
tab, a Filters selection displays at the top of the results, allowing you
to define that data that is returned.
Using filtering means that you do not need to create and change cri-
teria each time you return the results of a query.
n Use the Visible field to display or hide a column (or columns) on the
Results tab. Select True to display the column on the Results tab;
select False to hide it.
n Click to insert a new, blank line on the bottom of the
Fields grid. Use this open line to enter a custom formula to create
non-standard displays of data. The syntax of your formula must
match a built-in SQL function.
For example, you may want to display first initials and last names.
The Epicor HCM standard is first name and last name. Add a field as a
formula that concatenates the first letter of the value in the
FirstName column with the value in the LastName column.
The formula you enter must also include the name of the table from
where the data is pulled. Using the example above, the formula to
return the first letter of the first name is
SUBSTRING(tPerson.FirstName, 1, 1), where ‘SUBSTRING” is the
SQL function, ‘tPerson.FirstName’ is the table and column in the data-
base, and ‘1, 1’ tells the formula to start with the first letter and dis-
play one character (similarly, ‘1, 3’ would start with the first letter and
display three characters).
To add a new table to the query, click the Plus Sign (+) located in the upper-
right corner of the table. The Related Tables form opens in a new window
and lists all tables associated with your root table. Use the Search field to
quickly find a table to add to your query.
Epicor HCM | 5
Chapter: 1
Once you have located the table to add, click the next to the table name
and linking field to add the table to your query.
When adding tables to a query using the Related Tables form, remember:
n The Related Tables for only lists tables and views related to the par-
ent.
n Tables may appear more than once, as some tables are joined to the
parent table on multiple fields. For example, the Person Location His-
tory table is joined to the Person table twice: once on the PersonGUID
field for the employee and on the PersonGUID field for the
employee’s supervisor.
n When searching for a table to join, the results display any table where
there’s a match, including table names and column names.
You can also add tables to your query by locating the linking field in the base
table and clicking . This adds the table directly related to the linking field.
After building your query on the Designer tab, Query Builder administrators
can use the Query tab to work directly with the SQL on the Query tab. All
users can view the output on the Results tab.
Joins determine how the query relates data between two tables. There are
times when you will need to alter the joins in order to get the data you are
searching for in your query. There are three types of joins available for use
with Query Builder:
n INNER Joins: INNER joins retrieve only those records from one table
that have a matching record in the joined table. When one or more
table is added to a query, Query Builder automatically connects the
tables using an INNER join.
n LEFT OUTER Joins: LEFT OUTER joins retrieve all of the records from
the table listed in the left column regardless of whether or not they
have a record in the table in the right column.
n RIGHT OUTER Joins: RIGHT OUTER joins retrieve all of the records
from the table listed in the right column regardless of whether or not
they have a record in the table in the left column.
The following examples illustrate how the different join types return data:
The two tables join on the PersonGUID field and, by default, join using an
INNER join. As such, to be included in the results of the query, the Per-
sonGUID must be in both tables. The results of this join are:
tPerson Per- tPerson tPerson tPersonCertification tPersonCertification tPersonCertification
sonGUID Firstame LastName PersonGUID Certification Code Achieved Date
1234567 Joe Smith 1234567 APLUS 11/15/2009
4567890 Linda Johnson 4567890 MSCD 4/2/2011
Changing the INNER join to a LEFT OUTER joins returns all of the records
from the table on the left (tPerson) regardless of whether a corresponding
record exists in the table on the right. Using the same example tables above,
the results of the LEFT OUTER join are:
tPerson Per- tPerson tPerson tPersonCertification tPersonCertification tPersonCertification
sonGUID Firstame LastName PersonGUID Certification Code Achieved Date
1234567 Joe Smith 1234567 APLUS 11/15/2009
2345678 Susan Jones
3456789 John Davis
4567890 Linda Johnson 4567890 MSCD 4/2/2011
A RIGHT OUTER join is the opposite of a LEFT OUTER join. All of the data from
the table on the right is returned regardless of whether data exists in the
table on the left. The results of the RIGHT OUTER join are:
tPerson Per- tPerson tPerson tPersonCertification tPersonCertification tPersonCertification
sonGUID Firstame LastName PersonGUID Certification Code Achieved Date
1234567 Joe Smith 1234567 APLUS 11/15/2009
4567890 Linda Johnson 4567890 MSCD 4/2/2011
5678901 WORD 8/15/2013
Use OUTER joins when you know people in your Epicor HCM database will
not have a record in one of the tables, but you still want them to be listed in
the results. For example, if you want a list of all active employees and their
dependents regardless of whether or not they have dependents, use an
OUTER join. The OUTER join works in this case because every employee has a
record in the tPerson table, however, not every employee has dependents.
Epicor HCM | 7
Chapter: 1
When using OUTER joins in a query, if there is a table on the subordinate end
of an OUTER join, the second join must also be an OUTER join. OUTER joins,
once started, must be use to the terminus of the join connections.
Add Criteria
Adding criteria, or filters, to your query provides you with greater control
over the data it returns. Use the Criteria pane on the right side of the
Designer tab to add filters to your query.
The Criteria pane is divided into two sections: the top section shows you the
filters that are already included in the query. The bottom section allows you
to define any new criteria for your query.
If you selected either or both of the options to Auto-Select Current History
Records or Filter to Active Employees, then automatically generated criteria
are already included in Criteria pane.
When adding a new filter to your query, you have the choice for two filter
options: an AND filter or an OR filter:
n An AND filter means this rule and the other criteria must be met to
return a record. To add an AND filter to your query, click at
the top of the section. This activates the Criteria Builder section of
the Criteria pane, which you can use to define the filter.
n An OR filter means that the query results can contain records that sat-
isfy one rule or another rule, but do not have to satisfy both. To add
an OR filter to your query, right-click and select Add new OR.
This adds an ANY OF line to your criteria statement and activates the
Criteria Builder section of the Criteria pane.
Query Tab
The Query tab provides direct access to the SQL code, and because of that,
you should have a strong understanding of the SQL programming language
before using this tool. There are two main uses for the Query tab: creating
new SQL queries and updating the SQL code for a query designed on the
Designer tab.
Limitations are in place to provide a safer tool that cannot be used to change
the data within the database. Be aware of the following security related
items when using the Query tab in Query Builder:
n Only Query Builder Administrator users can modify a query using the
SQL tab.
Epicor HCM | 9
Chapter: 1
Results Tab
The Results tab displays the results from a query. From here, you can page
through the results, re-size columns, export the results to a Microsoft Excel
spreadsheet (click the MS Excel icon in the upper-right corner), and print the
query (click the printer icon). When view data on the Results tab, be aware of
the following:
n Query Builder enforces row security on the Results tab.
n Epicor HCM decrypts any encrypted fields.
My Query Component
The My Query component is a home page component in Epicor HCM. Users
can display the My Query component on their My Home page.
The My Query component displays shared query, as well as the ones users
create themselves. To add the My Query component to your My Home page:
When saving a query, you have the option to share the query. Select the
Share This Query check box to allow other uses to access your query from the
My Query component.
Shared Queries n Can be seen by all users on the My Queries component on the My
Home page
n Can be seen by all users on the My Queries component on the My
Home page
n Can be seen by all users on the My Queries component on the My
Home page
n Can be seen by all users on the My Queries component on the My
Home page
Private Queries n Can only been seen by creator and Query Builder administrators on
the My Query component
n Can only been seen by creator and Query Builder administrators on
the My Query component
n Can only been seen by creator and Query Builder administrators on
the My Query component
Epicor HCM | 11
Chapter: 1
3. Click the to add the table to your query, and then close the
Related Tables form.
The new table is now linked to the tPerson table on the Designer tab.
4. Open the Results tab.
Notice that no data returns. This is because you have not
added any fields to your query.
5. Return to the Designer tab.
6. Add fields to your query by selecting the check box next to the field
name.
7. Open the Results tab again.
You should now see data for the fields you added to the query.
Add Criteria
To modify the way the query searches for data, you can assign criteria to spe-
cific parts of the query to include or exclude certain field data.
Epicor HCM | 13
Chapter: 1
5. In the Operator list, select the operator to use for this criteria. For
this example, select =.
6. In the Value field, enter the value to use for this criteria. For this
example, enter John.
7. Click Save.
8. Verify that the FullName field is included in the fields that are used
for this query.
9. Open the Results tab.
Only employees with the first name John are included in the results
of the query.
Manage Joins
Use the Joins tab to modify the joins between tables. Modifying joins allows
you to control how the relationship between tables are processed when a
query is run.
To change a join type, click the Join Type field between the two tables, and
then select the new join type.
To save your query as a view, and, therefore, be able to use the query in
Report Builder:
1. From the File menu, select Save.
The Save Query form opens in a new window.
2. Select the Create a View check box.
The Enter a view name to create field appears with the name of
your query automatically populated.
3. Update the name of the SQL view or accept the default. Spaces and
special characters cannot be included in the view name.
4. In the Enter a description of the query field, enter or update the
description of the query. If you entered a description when you first
created the query, that description automatically populates in this
field.
5. Select the Share This Query check box if you want to make the
query available to others people.
6. Click OK. Epicor HCM saves the query to the Query Builder table
(USysQueryBuilderQuery) with a “vuser” prefix.
Before you can use the new view in Report Builder, you must first
regenerate the Reporting Model.
7. In Epicor HCM, navigate to the Utilities menu, and then select Sys-
tem Configuration Generate Business Library.
8. Clear the Update Business Assembly check box, and verify that the
Update Reporting Model check box is selected.
Epicor HCM | 15
Chapter: 1
Real-World Examples
Now that you have reviewed the basics Query Builder, you are ready to begin
using Query Builder to its fullest.
Epicor HCM | 17
Chapter: 2
Use the Fields/Joins pane at the bottom of the page to sort the results:
1. On the Fields tab, drag the rows so they are in the following order:
a. tPerson.PersonGUID
b. tLocation.LocationDescription
c. tDepartment.DepartmentDescription
d. tPerson.LastName
e. tPerson.FirstName
f. tPerson.EmployeeID
2. In the Sort Order list, select Ascending for the following fields:
n tLocation.LocationDescription
n tDepartment.DepartmentDescription
n tPerson.LastName
3. Open the Results tab.
Your query displays the list of all employees and their current loc-
ation, sorted by location description, department description and
employee last name.
4. Save the query as a stand-alone or as a view that you can use in
Report Builder.
Epicor HCM | 19
Chapter: 2
Epicor HCM | 21
Chapter: 2
13. In the tFrequency table, select the Frequency Adjective check box.
Epicor HCM | 23
Chapter: 2
14. In the Criteria pane, right-click , and then select Swap Oper-
ator.
The criteria changes to .
15. Click to activate the Criteria Builder.
19. In the Condition Type section, select Column-Value.
20. In the Select Table list, select tPersonStatusHist.
21. In the Select Column list, select PersonStatusCurrentFlag.
22. In the Operator list, select =.
23. In the Value field, enter 1.
This criteria filters for employees' current status.
24. Click Save to set the criteria for this query.
25. From the File menu, select Save.
26. Select the Create a View check box, and then click OK.
27. In Epicor HCM, from the Utilities menu, navigate to System Con-
figuration Regenerate Business Library.
28. Clear the Update Business Assembly check box and verify that the
Update Reporting Model check box is selected.
29. Click Regenerate Business Objects. This process may take several
minutes to complete.
Once the business objects regeneration finishes, the new, custom superview
you created here is available to use in Report Builder.
Epicor HCM | 25