Setting up sample queries
These samples are designed to walk you through the basic steps involved in creating custom queries using Secure Query .
This sample query is an Employee Original Hire Date List that retrieves the following information: employee first name, employee last name, original hire date, benefit description, and employee premium. This list is grouped by the benefit plan description. The information is sorted in ascending order. There are subtotals for each group and a grand total. The query output is a Report with Landscape layout.
- Select either Reports > Employees > Secure Query or Reports > Training > Secure Query.
- In the Query List Manager window, click New.
- In the Enter a Title for this New Query window for New Title, enter Employee Original Hire Date. This query title appears at the top of pages and prints on most reports.
- For Access Type, select Private (for personal use only).
- Click .
- In the Select Data To Use in Query window on the Choose Employee Information tab, select Demographics and HR Status.
- Click the Choose Additional Information tab, select All Benefits, and click OK.
-
In the Select Fields to Show in Query window in the Fields to pick from list, double-click or press the Ctrl key to select the following fields:
- First Name
- Last Name
- Original Hire Date
- Benefit Description
- Employee Premium
The selected fields appear in the Fields to include in query list (on the right) in the order in which you selected them. This will be the order they display in your query.
Note: To remove a field from the Fields to include in query list, highlight it and click or double-click it.
- If you want to change the order of the fields, move your cursor over the button to the left of the field until you see a two-headed arrow.
- Press your left mouse button and drag the field to the new position.
- Release the mouse button.
- The field moves to the new position and the other fields automatically reorder to accommodate the moved field.
- Click .
- On the Query main page on the Output Results tab, select Report (Landscape Layout).
-
On the Group Records tab:
- For Group records first by this field, select Benefit Description.
- Clear the Count the number of records in the group check box.
- Select the Show Detail records in the group check box.
- For Summarize the records for this numeric field list, select Employee Premium and click once to highlight it.
- Select Sum the records in this field.
-
On the Sort Records tab:
- Click the Select Order button.
- In the Select Sorting Order window for Fields to pick from list, double-click Benefit Description and Last Name. Both fields automatically default to ascending order.
- Click OK.
- Click Run Query.
- Because you selected Report (Landscape Layout) as the output, the Report Setup window opens. Select Preview.
- Click Start Report. The Report Preview window opens and displays the report.
This sample query copies the Employee Original Hire Date List to create a Benefit Summary report, and then adds a record count. The query output is a Report with a Portrait layout.
- In the Query List Manager window, select the Employee Original Hire Date query; (click once to highlight it).
- Click Copy.
- In the Enter a Title for this Copied Query window for To New Title, enter Benefit Summary.
- Click .
- In the Query List Manager window, select Benefit Summary and click Open.
- On the Query main page on the Output Results tab, select Report (Portrait Layout).
-
On the Select Fields tab:
- Click the Select Fields button.
- Remove the First Name, Last Name, and Original Hire Date fields from the query by either double-clicking or highlighting the field and clicking .
- Click .
-
On the Group Records tab:
- Select the Count the number of records in the group check box.
- Clear the Show Detail records in the group check box.
- Click Run Query.
- Because you selected Report (Portrait Layout) as the output, the Report Setup window opens. Select Preview.
-
Click Start Report. The Report Preview window opens and displays the report.
Notice that a column for the Record Count was added after the Employee Premium column.
This sample query filters the Employee Original Hire Date List so only employees with a status of either active or leave of absence are included. It also has a condition that prompts you for a date range for the original hire date when the query is run.
- In the Query List Manager window, select the Employee Original Hire Date query; (click once to highlight it).
- Click Filter.
- On the Set Record Filter window on the Pick a Field tab, select Original Hire Date.
- Click Next to move to the Pick an Operator tab.
- Select Between two dates.
- If needed, click Next to move to the Enter a Value tab.
- Select Ask later.
-
On the Conditions List page, add a new condition for employee status:
- Click Add.
- In the Select a Connector window, select And.
- In the Set Record Filter window on the tab, select Employee Status Code (A/T/L/D/N).
- Click Next to move to the Pick an Operator tab.
- Select Exactly matches.
- If needed, click Next to move to the Enter a Value tab.
- Select A from the drop-down list and click .
- On the Conditions List page, click .
- In the Select a Connector window, select Or.
- In the Set Record Filter window on the tab, select Employee Status Code (A/T/L/D/N).
- Click Next to move to the Pick an Operator tab.
- Select L from the drop-down list and click .
-
Add brackets to the condition:
- On the Conditions List page, select Employee Status Code (A/T/L/D/N) exactly matches A; (click once to highlight it).
- Click Bracket.
- In the Insert or Remove Parentheses window, click Insert. A check mark indicates the condition you selected.
- Select Employee Status Code (A/T/L/D/N) exactly matches L and double click (to place the matching ending parentheses).
- Click Done. (If the Enter a Value tab opens, click Cancel.)
- In the Query List Manager window, select the Employee Original Hire Date query; (click once to highlight it).
- Click Open and then click Run Query.
- When the Enter a Value tab opens, enter a From and To date for the query, and then click .
- In the Report Setup window, select Preview.
- Click Start Report. The Report Preview window opens and displays the report.