This section discusses creating and executing a query which are the two most common use cases for QAS.
QAS provides several service operations that can be used by an external application to access the PeopleSoft application database to select records and fields to create a valid PeopleSoft Query. Creating a query involves several steps, some of which do not require access to the PeopleSoft records, fields, and trees and therefore do not have associated service operations.:
You can use QAS_RECORDS_OPER, QAS_RECORD_DEFN_OPER, QAS_RELATED_RECORDS_OPER, and QAS_HIERARCHY_RECORDS_OPER to select records.
QAS_FIELDS_OPER and QAS_FIELD_PROPS_OPER can be used to help select the fields and prompts to add to the query content.
QAS_TREE_OPER and QAS_TREE_DETAILS_OPER can be used when your selection criteria uses trees.
The QAS_SAVE_QUERY_OPER is used to save a query definition to the PeopleSoft database.
To execute an existing query in the PeopleSoft database, the external application will use Query Metadata Services, Query Execution Services, and possibly the Query Result Service. This diagram illustrates the steps and corresponding service operations that can be used to execute a PeopleSoft query and retrieve the results:
To execute a query, you will need to know the query name. QAS_LISTQUERY_OPER, QAS_LISTQUERYFIELDS_OPER, and QAS_QUERY_DETAILS_OPER can be used to help select the query name.
For queries containing prompts, use QAS_GETPROMPTTABLEVALUES_OPER, QAS_GETXLAT_OPER, and QAS_LISTQUERYPROMPTS_OPER to identify the prompts and obtain a list of values.
You can also filter fields to be retuned in the query results using QAS_LISTQUERYFIELDS_OPER.
You can select how you want to execute the query and use the appropriate service operation.
For synchronous poll execution, you will use QAS_GETQUERYRESULTS_OPER to retrieve the results.
You can invoke QAS_CANCELQUERY_OPER after obtaining the query result to clean up the PSQASRUN and IB tables.
You can check the query status using QAS_QUERYSTATUS_OPER.