This chapter provides an overview of query types, and discusses how to:
Save queries.
Run queries.
Add queries to the Internet Explorer Favorites list.
Download queries.
Perform lookups.
Print query results.
Use Query Viewer.
PeopleSoft Query provides the following different types of queries:
User queries retrieve data from the database directly from Windows-based Query Designer or the web-based Query Manager/Query Viewer applications. Note. Because of the range of possible circumstances in which you might run an ad hoc query, there are no special considerations or requirements that apply to all of them. |
|
Reporting queries are essentially the same as user queries, except that they are designed to be used by another reporting tool. Reporting queries can be used as data sources for ad hoc queries, scheduled queries, Crystal Reports, PS/nVision, Cube Manager, or XML Publisher. When you define a custom report, you often include runtime variables that users specify when they run the report. For example, you might want users to be able to say which business unit, location, or time period to report on. Therefore, your reporting query may include one or more runtime prompt variables. If your query requires input parameters, you must decide how users should enter them. If they run the report from any of the PeopleSoft Query applications, they can enter values into the page that appears in Query Manager, Query Viewer, or Scheduled Query. When reporting queries are used as a data source to another third party reporting product, you may need to:
|
|
Process queries are queries that you intend to run periodically using a batch process. Create these automated batch processes using PeopleSoft Application Engine and the Query API. For example, you could write a query that returns any overdue receivables and schedule a batch process to run the query once a week. Note. Process and role queries override the automatic row-level query security logic that is applied to all other types of queries. For this reason, you should restrict access to creating these types of queries to administrative roles and not include any sensitive data columns in the select list for these types of queries. You can restrict access to creating/modifying these queries based on Query Profile settings assigned to a Permission List. Also note that Workflow queries also override the row-level security logic. |
|
PeopleSoft Workflow uses role queries to determine to whom to send an email, form or worklist entry. A role query needs to return one or more role IDs based on the data that has been saved on the page that is triggering the routing. Because a role query returns a list of role users, the record definition that you want is either PSROLEUSER (which lists role users and the roles to which they are assigned) or ROLEXLATOPR (which lists role users and their IDs). The only field that you select in your query is ROLEUSER. Of course, you use other fields and join to other record definitions to specify the criteria that role users can select. But no matter how complex the query is—how many joins or selection criteria it has—it must return ROLEUSER and nothing more. Define a role as a query because you want to route items differently based on the context of the transaction that the users are performing. Thus, every role query contains at least one bind variable whose value gets set at run time. The bind variable or variables correspond to the data on which you want to base the routing decision. At run time, the system sets the values of the bind variables based on data from the page that triggers the event. Save your role queries with names that begin with [ROLE] so that you can identify them as role queries. Note. Process and role queries override the automatic row-level query security logic that is applied to all other types of queries. For this reason, you should restrict access to creating these types of queries to administrative roles and not include any sensitive data columns in the select list for these types of queries. You can restrict access to creating/modifying these queries based on Query Profile settings that are assigned to a Permission List. Note that Workflow queries also override the row-level security logic. |
|
You can save a query as an archive query if you have access to workflow queries that include Archive Query, Role Query, and Process Query. These queries are generally only used by the PeopleSoft Data Archive Manager. See Using PeopleSoft Data Archive Manager. Note. You can only create and save archive queries as public. |
|
Use PeopleSoft Query to create a query in order to specify the data source for a PS/nVision report layout. However, if you want to use your query in a PS/nVision matrix layout, you must apply aggregate functions to at least one column. Queries used with PS/nVision tabular layouts do not have the same restrictions as matrix layout queries; they are like other reporting queries and do not require an aggregate column. |
Dirty Reads mode—also called Read Only mode—enables you to configure your servers to avoid table locking while running PeopleSoft queries. When Dirty Read mode is enabled for PeopleSoft Query, the performance is increased as queries do not lock on other INSERT and UPDATE operations.
Dirty Read mode is set in configuration files for PeopleSoft Application server and PeopleSoft Process Scheduler server:
In PeopleSoft Application server, under section [PSQRYSRV], the setting ‘Use dirty-read’ controls behavior for PSAPPSRV, PSQCKSRV, and PSQRYSRV.
In PeopleSoft Process Scheduler server, under section [PSAESRV], the setting ‘scheduledquery-dirtyread’ controls behavior for scheduled query process executing under PSAESRV process.
See Also
Setting Parameters for the Application Engine Server
This section describes how to:
Select records.
Add fields to query content.
View fields selected for output.
Change the column order for multiple fields.
Change the sort order for multiple fields.
Edit field properties.
View and edit query properties.
View underlying SQL code.
Preview query results prior to saving.
Access the Query Preferences page.
Name Style |
Specify how record and field names are displayed. Select one of the following:
This is used mostly for global users where the record and field names are in English but the descriptions are in another language. |
Enable Auto Join |
Select to indicate that your query should automatically determine the join conditions when a new record component is added. |
Enable Auto Preview |
Select to indicate that your query preview should automatically rerun each time you access the Run page of the Query Manager component. This option is selected by default. |
See Also
Adding Fields to Query Content
Previewing Query Results Prior to Saving
Understanding Internally Controlled Options
Access the Records page.
Note. In your PeopleSoft database, tables are represented as record definitions. In PeopleSoft Query, we refer to the record definitions as records.
Find the record upon which to base the query.
If you know the entire record name, description, access group name, or field name included in the record, select the appropriate item in the Search By drop-down list box. Enter the name in the field (or click the Look Up button if searching by access group name). Then click the Search button to display a list of records that match your search criteria.
You can perform a partial search by entering part of the name in the Search By field.
Note. Enter as much of the name as possible to find the correct record.
You can perform an advanced search by clicking the Advanced Search link. You can perform a progressively narrower search by selecting conditions for the record name, record description, or field name contained in the record, and then entering an appropriate search string in the fields that correspond to your selections. For access group name, select a condition, click the Lookup Name button, and then select the access group name from the list of access group trees that appears.
If you want to view a list of available records, leave the field blank and click the Search button to display a list of up to 300 records.
By default, only the first 20 records appear on the page. To see more of the list, use the navigation buttons and links located on the header bar. To display 100 of the records, select the View 100 link, and use the scrollbar to go through the rest of the list.
If you want to view a record's fields, click Show Fields next to the record in question.
A page displays the record's fields. You can use this information to verify whether you want to base the query upon this record.
Click Return when you have finished looking at the fields.
Click Add Record next to the record you want to add to the query.
This takes you to the Query field, from which you can select which fields from the selected record to add to the query.
Note. In most cases, you select only one base record from this page. If you navigate back and select a second base record, you are creating an any join for the two records.
See Also
Access the Query page.
To add fields to your query:
Select the fields to add to the query either by clicking their check boxes or by clicking the Check All Fields button.
When you have selected the desired fields, select the Fields tab.
See Also
Access the Fields page.
Access the Edit Field Ordering page.
Enter the new column number to reorder the columns. Columns that are left blank or assigned a zero are automatically assigned a number. |
|
Order By |
Current sort order. |
Descending |
Select this check box to sort fields in descending order. |
New Order By |
Enter the new sort order number to change the sort order. Enter zero to remove a sort order. If the field is the first sort field, enter 1, and the system sorts rows based on this field first. To designate the second sort field, enter 2, and so on. |
Access the Edit Field Properties page.
See Also
Working with Aggregate Functions
Access the Query Properties page.
See Also
Access the View SQL page.
Access the Run page.
You can save a query at any time after you have selected one record and at least one field for it. Save queries from any Query Manager page (except for the Run page) by clicking either the Save button or the Save As link. You must enter some basic information about the query before the system allows you to save it for the first time.
To save a query for the first time:
After you make your changes in Query Manager, click the Save button.
In the Query field, enter a short name for the query.
In the Description field, enter an appropriate description for the query. This information will help you identify the query later.
In the Folder field, enter the name of the folder into which you would like to save the query.
To create a new folder, enter the name of the new folder.
Note. The folder that you create does not reside on your local drive. You create a folder for the purpose of describing the query and to facilitate grouping and sorting.
Select a query type.
Standard queries are designated as User queries. If you have access to workflow queries, your list of types will also expand to include role, process, and archive.
In the Owner field, select whether your query is Public or Private.
Private: only the user ID that created the query can open, run, modify, or delete the query.
Public: any user with access to the records used by the query can run, modify, or delete the query.
Enter the query definition.
Click OK to save the query.
Note. Using Save As creates another instance of the query that you can modify and save under a different name. When you select Save As, the page you just saw appears, enabling you to change the name, description, and owner of the new query.
You can run a predefined query from your browser and view it online. When you click the Run button on the Query Manager search page, PeopleSoft Query displays the results in a new browser window. This Run option is useful if you want to run multiple queries or run the same query multiple times with different run time prompt values and compare the results of the queries.
If you want to run queries that you haven't saved, you can use the Run page in the Query Manager.
To run a query:
Select Reporting Tools, Query, Query Manager.
Search for a query using the basic or advanced search function.
Both search types allow you to use the following search by criteria: access group name, description, folder name, owner, query name, type, uses field name, and uses record name. The basic search allows you to search using the begins with condition. The advanced search allows you to perform a progressively narrower search by using one or more search by criteria and selecting from a broad choice of conditions. These are instructions on using search by criteria:
If you know the entire name of the query that you want to run, select Query Name from the Search By drop-down list box, and then enter the query name in the Search By field.
If you do not know the name of the query and want to search through a list of queries, leave the Search By field blank and click the Search button to display a list of up to 300 queries.
Perform a partial search by entering part of the search string in the Search By field.
To search using any other search by criteria, select the appropriate item from the Search By drop-down list box, and then enter the search string in the field.
To perform an advanced search, click the Advanced Search link on the Query Manager Search page.
On the Advanced Search page, select the appropriate search by criteria and conditions, and then enter a search string in each of the corresponding fields.
Click the Search button to display a list of queries that match your search criteria.
The Search Results page appears. The results list all the queries that match the search criteria. The following information appears:
Query name.
Query description.
Owner (public or private).
Folder.
Scroll to the name of the query that you want to run.
By default, only the first 30 queries appear on the page. To see more of the list, click the navigation buttons and links located on the header bar.
To display 100 of the queries, select View 100 and use the scrollbar to view the remaining of the list.
To run a query, use the following links on the row of the query:
Note. If a Query—that is used as a data source for XML Publisher— is run through Reporting Tools, Query, Query Manager, the XML Publisher-related prompts do not appear. The normal basic table-formatted Query results are generated.
See Scheduling Queries.
See Running XML Publisher PeopleSoft Query Reports.
See Also
To add a query to the Favorites list on the Internet Explorer menu:
Right-click the HTML link on the Query Manager or Query Viewer search page.
Click the Add to Favorites option on the Internet Explorer menu.
The Add Favorite page appears.
Change the text in the Name box to the name of your query.
Click OK.
Internet Explorer adds the query to your Internet Explorer Favorites list.
You can download your query to an Microsoft Excel spreadsheet or CSV text file.
After you have downloaded the query to Microsoft Excel, the first row in the spreadsheet displays the total number of rows of your query that are included in the spreadsheet.
Note. A Microsoft Excel spreadsheet can contain a maximum number of 65,536 rows. If the spreadsheet cannot include all of the rows
in your query, the first row displays—in a red font—the total number of rows returned by the query. If this number is greater
than 65,536, Microsoft Excel spreadsheet did not include the remaining rows.
If you download your query from the Run page, the query has a different default filename than if you download your query after
clicking the HTML or Excel links. These default filenames are different because: (a) using the Run page to run queries, queries are run using the application
server, and (b) using the HTML or Excel links, queries are run using a query service.
To download your query results, select one of the following:
Excel: Click this link on the Query Manager or Query Viewer search results page.
Download to Excel: Click this link on the Query Manager or Query Viewer Run page.
Excel SpreadSheet: This option is available after you have clicked the HTML link on the Query Manager or Query Viewer search results page. However, you can also click the Download to Excel or Excel links without downloading the query to HTML.
Microsoft Excel 2000 or later is preferred. If you’re using Microsoft Excel 97, select the CSV Text File link when you need to download large result sets.
You can configure your environment to open the Microsoft Excel file in a separate window or save it as a file on your local hard drive by modifying the File Type Option settings for Microsoft Excel Worksheets.
Note. Downloaded data such as numbers and dates are formatted in the Microsoft Excel spreadsheet according to the regional settings
on the user's machine.
If you use the Windows or Macintosh operating systems, you can set your downloaded queries to open in browser windows instead
of in the Microsoft Excel application. To set this option in Windows, select the XLS file type in your folder options and
select the Browse in same window check box. When this check box is cleared, downloaded queries open in the Microsoft Excel application.
The query name and run time parameters have now been added when downloading to Microsoft Excel from Query using Query Viewer
or Query Manager. However, run time parameters are not downloaded when using the RUN option.
CSV Text File: This option is available after you have clicked the HTML link . If you click this option, the File Download page appears, at which point you can open the file in your browser or save it to disk.
Note. The output has no formatting and does not support UTF-8 encoded data.
To modify the File Type Option settings for Microsoft Excel Worksheets when using Microsoft Windows 2000:
Open Windows Explorer.
Select Tools, Folder Options, File Types.
Select XLS (Microsoft Excel Worksheet).
Click the Advanced button, and select or clear the Browse in same window check box.
Applying a Formula to a Newly Inserted Column
When working in Microsoft Excel on a query that you have downloaded, adhere to the following guidelines in order to insert a new column into the spreadsheet, and then add a formula to that column.
When you insert a new column in Microsoft Excel, the new column's cells assume the default format from one of the adjacent columns—typically the left column. For example, if you insert a column between columns B and C, the new column takes on the format of column B. If column B is formatted as Text, you cannot apply a formula to the newly inserted column.
Note. If the columns adjacent to the newly inserted column have a format of General, you should be able to apply a formula without performing the following procedure.
To apply a formula to a newly inserted column:
Highlight the newly inserted column.
Change the column's format from text to general by selecting Format, Cells, and then selecting General from the list of categories on the Number tab.
Insert the formula into the column.
Some queries are designed to prompt you for information when you run them. This approach narrows the query results to match the information that you entered. To help you enter the correct information, you can perform a search using the Look Up button that appears on the page.
For example, the ADDRESSLIST query prompts you for a specific employee ID. You might know an employee’s last name, but not have the employee ID handy. Using the Look Up button, you use the information that you do have to find the required information.
In this example, we perform a basic lookup using ADDRESSLIST.
To perform a lookup:
Click the HTML link from the Query Manager search page for the ADDRESSLIST query name from the query list.
If you know the employee ID for the address that you are looking up, enter it in the EmplID (employee ID) field; if you need to search for the employee ID, click the Look Up button.
On the Look Up page, click the drop-down arrow to find more search values.
In this example, you can select EmplID, Name, or Last Name. To find all values for this field, leave the search field blank and click the Look Up button. You can also display all of the search fields at once by clicking the Advanced Lookup link.
Select the value to search by, and then click the Look Up button.
In this example, we know the employee’s last name, but not his employee ID.
Your lookup information appears on the page.
Click the link in the result field.
The Query page appears with the required value already complete.
Click the View Results button.
The query results appear on the page.
Before you can print query results, you must run the query.
To print query results on your default printer:
Click either the HTML or Excel links.
Click the Print button or select File, Print.
If you download the query to Microsoft Excel, you can print the query using Microsoft Excel’s print function.
If you download the query as a CSV text file, you can print it using the print functions of the applications you use to work with it.
Note. To grant users access to download your query to Microsoft Excel, you must make sure that their permission lists include the WEBLIB_QUERY web library with full access.
See Setting Query Permissions.
Query Viewer is a read-only version of Query Manager. It enables security administrators limit some users to read-only access for all queries, so they can only view or print queries.
Query Viewer enables you to:
Search for a query using the basic or advanced search functions.
Both search types allow you to select the following search by criteria: access group name, description, folder name, owner, query name, type, uses field name, and uses record name. The basic search enables you to search using only the begins with condition. The advanced search enables you to perform a progressively narrower search by using one or more search by criteria and selecting from a choice of conditions for each search by criterion.
Run a query (which displays results in a new browser window).
To run a query, click the HTML or Excel button to the right of the query on the Search Results page.
Download the results to a Microsoft Excel spreadsheet or a CSV Text file.
To download the results, first click the HTML link associated with the query on the Search Results page. Then, to download the results to a CSV text file, click the CSV Text File link on the HTML results of the query. To download the results to a Microsoft Excel file, click the Excel Spreadsheet link on the HTML results page.
Print a query.
Schedule a query.
From the Search results page, click the Schedule link associated with the query. Query Viewer interacts with PeopleSoft Process Scheduler to enable you to schedule queries. You can submit requests to schedule a query, check the status of your request using Process Monitor, and view your output using Report Manager.
See Using Report Manager.
Note. Online viewing of Query-based XML Publisher reports is available by navigating to Reporting Tools, XML Publisher, View Query Report.
See Also
Previewing Query Results Prior to Saving
Running Reports in Query Report Viewer