Running a Query

With query API, you have the following options for running a query:

  • Using the RunToRowset method.

    This method takes a QueryPrompt record as input and returns a PeopleCode rowset containing the query result. You should always use a standalone rowset (that is, one that was created using CreateRowset).

  • Using the RunToFile method.

    This method takes a QueryPrompt record and a file name as input and writes the query result to the file.

  • Using the RunToString method.

    This method takes a QueryPrompt record and writes the query result to a formatted string.

Note: For the query classes, all Date, Time, and DateTime fields that are part of a query are now required fields when running a query.

Considerations Using the RunTo Methods

RunToRowset may require a lot of memory for the Rowset object; therefore, it also takes more processing time. PeopleSoft recommends that RunToRowset not be used for retrieving large result sets, on the order of 50,000 or more items.

All of the RunTo methods can be called to run a query before saving it—that is, it isn't necessary to first save the query.

The last parameter of all of the RunTo methods is the maximum number of rows to fetch.

  • -1 returns all rows regardless of the setting on the security profile.

  • 0 returns the maximum number of rows allowed by the security profile.

  • >0 is the limit on the number of rows.

For scheduled queries, the system uses the language specified in the user’s profile. It does not use the language selected during signon. The system also uses the International and Regional settings the user specified using My Personalizations. If no personal setting have been specified, the system uses the default installation international settings.

Note: Most PeopleSoft components can default to international settings from the browser if the user has not set any user specific settings. However, this is not available for scheduled queries or any Process Scheduler processes.