Query Class Properties

In the following section, we discuss each Query class property.

Description

This property returns a string indicating whether a query is approved, unapproved, or modified. This is useful for query administration. The values are:

Value

Description

U

Query is unapproved. This is the default value. The query administrator can prevent execution of unapproved queries.

A

Query has been approved by the query administrator.

M

Query has been modified.

This property is read/write.

Description

Note: This property has been deprecated, and remains for backward compatibility only. Use the ApproveUserId property instead.

This property returns a string containing the user ID of the user who approved the query. This can be useful for query administration.

This property is read/write.

Related Links

ApproveUserId

Description

This property returns a string containing the user ID of the user who approved the query. This can be useful for query administration.

This property is read/write.

Description

This property returns the date-time stamp when the query was most recently approved. This can be useful for query administration.

This property is read-only.

Description

Note: This property has been deprecated, and remains for backward compatibility only. Use the CreateUserId property instead.

This property returns a string containing the User Id of the user who created the query. This can be useful for query administration.

This property is read-only.

Related Links

CreateUserId

Description

This property returns a string containing the date-time stamp indicating when the query was created. This property is set by the query runtime when a new query is saved. This can be useful for query administration.

This property is read-only.

Description

This property returns a string containing the User Id of the user who created the query. This can be useful for query administration.

This property is read-only.

Description

This property returns or sets the short description for the query.

The length of this property is 30 characters.

This property is read/write.

Description

This property indicates if the query is active or not. This property returns a string value:

Value

Description

Y

This query is not active

Blank or any other value

This query is active

This property is read/write.

Description

This property specifies the name of the application executing the query. This property isn't required. This means this property is used only if the query will be executed. This name is stored in the query execution log. This property returns a blank value when the query is opened.

When executing a query using the query API, this property should be set to the Application name that's executing it, so that the Query Monitor can track query execution. Doing this makes this property useful for query administration. If you try to read this property before setting it, you receive a NULL string.

This property should be set before using RunToRowset or RunToFile.

This property is read/write. However, this property is generally used only to set the name, rather than to read it.

Description

This property indicates whether an execution log should be created when the query is executed. This can be useful for query administration. This property takes a Boolean value: True, create a log, False, don't create one.

The execution log, which is created by setting this property, can be viewed from the Query Monitor. The logging is done in a PeopleSoft Table. It stores, along with other relevant information, the Execution DateTime, Total Execution Time for the query, and Total Fetch Time for the query.

If you try to read this property before setting it, you receive a NULL string.

This property is read/write. However, this property is generally used only to set logging, rather than read.

Description

This property is used to group queries together. This parameter takes a string value, up to 18 characters.

This property is read/write.

Description

This property returns the last SQL error code returned by the database as a number. The session object contains the error text and any other errors encountered while executing the query.

PeopleSoft recommends checking this value after using RunToRowset or RunToFile.

This property is read-only.

Description

This property returns the most recent date-time when the query was updated as a string.

This property is read-only.

Description

This property returns the User Id of the user who updated the query most recently as a string.

This property is read-only.

Description

This property returns or sets the long description for the query.

The length of this property is 256 characters.

This property is read/write.

Description

This property returns a metadata collection.

This property is read-only.

Example

&MetadataList = &MyQuery.Metadata;

Description

This property returns the SQL that represents the query, unresolved for any platform.

For example, the MetaSQL property returns the following:

SELECT %DATEOUT(A.ASOF_DT)
 FROM PS_AEREQUESTTBL A
 WHERE A.ASOF_DT = %DATEIN('1900-01-01')

This property is read-only.

Description

This property returns a Boolean value indicating whether “chunking” is turned on for the query.

This property is read-only.

Chunking Considerations

Every time a row is retrieved from the query result set, it is added to the internal output string managed by RunToString. At this point, the method can check to see if chunking is active. If so, and if the current size of the output string is larger than the ChunkSize parameter, then the query context is stored and the output string is returned. If not, then the next row is retrieved from the result set and the process continues.

When chunking is active, RunToString is intended to be called in a recursive fashion until the result set has been completely traversed. A Boolean property, MoreRowsAvailable, is included in the Query class to control recursive execution of these methods.

Description

This property returns the name of the query as a string.

The length of this property is 30 characters.

This property is read-only.

Description

Use this property to set or return a Boolean value indicating whether the RunToFile method will create a Unicode-encoded CSV file as output. This property is applicable only if the output format is set to %Query_TXT. Because the default value is false, OutputUnicode must be set before calling RunToFile.

Note: Because Microsoft Excel does not support UTF-8 encoding, the CSV file is written in binary mode with UCS-2 encoded data. Moreover, Excel does not automatically recognize Unicode-encoded, comma-delimited files even if they have a .csv extension. Therefore, the user receiving the file will not be able to open it by double-clicking. Instead, he or she must open it with Excel’s File, Open menu and choose the comma delimiter.

This property is read/write.

Example

&aQry.OutputUnicode = True;
&Result = &aQry.RunToFile(&rcdQryPrompts, &sOutFile, %Query_TXT, 0);

Description

This property is used to set the PDF Font number required for generating PDF using RunToFile. This property takes either a numeric or constant value. The values are:

Numeric Value

Constant Value

Description

0

%PDFFont_None

Default value

2

%PDFFont_TraditionalChinese

The output must be written using the Traditional Chinese Font.

3

%PDFFont_SimplifiedChinese

The output must be written using the Simplified Chinese Font.

1

%PDFFont_Japanese

The output must be written using the Japanese Font

4

%PDFFont_Korean

The output must be written using the Korean Font

If you try to read this property before setting it, you receive a NULL string.

This property is read/write.

Related Links

RunToFile, RunToRowset

Description

This property returns all the prompts defined for the Query in a QueryPrompt Collection. If you just want the prompts used in the criteria, use the RunTimePrompts property.

This property is read-only.

Description

This property returns the runtime prompts of a query as an instance of a PeopleCode record object. This can be used with the Prompt built-in function to prompt for bind values. This record instance can also be used as the first input parameter for the RunToRowset and RunToFile methods.

This property is read-only.

Related Links

RunToFile, RunToRowset

Description

This property specifies whether the query is public or private.

You can use either a constant or numeric value for this property. The values are:

Numeric Value

Constant Value

Description

0

%Query_Private

The query is a private query.

1

%Query_Public

The query is a public query.

This property is read/write.

Example

If &QryObj.PublicPrivate = %Query_Public Then 
   /* code when working with Public Query */ 
Else 
   /* code when working with Private Query */ 
End-if;

Description

This property returns the Main Select (that is, the first select) of the query definition as a QuerySelect object. For a new query which does not have any selects, it returns NULL.

The Query Records, Query Criteria, QueryOutput fields, and QuerySelected Fields can be obtained using the QuerySelect object only. Hence, after opening a query, this property serves as the starting point for getting the different components of the Select statement.

This property is read-only.

Related Links

QuerySelect Class

Description

This property returns statistical information pertaining to the query’s execution as a QueryStatistics object.

This property is read-only.

Related Links

QueryStatistics Class

Description

This property returns the prompts used in the Query Definition’s criteria in a QueryPrompt Collection. To return all the prompts defined for the query, use the Prompts property.

This is property is read-only.

Description

This property returns the SQL statement as generated from the query definition as a character string.

Note: The value of the SQL property is never stored as part of the query definition. Instead, it's generated by the system whenever it's needed for one of the RunTo methods or for the SQL property.

In the PeopleSoft Query, this is located under the SQL tab.

This property is read-only.

Considerations Using the SQL Property

This property returns a basic SQL statement. This statement does not include logic for doing related language record transactions or translate descriptions. PeopleSoft does not recommend using this SQL for selecting data. Instead, PeopleSoft recommends using the RunToRowset method for selecting data.

Description

This property specifies the type of query. This parameter takes either a constant or number value. Values are:

Numeric Value

Constant Value

Description

1

%Query_Query

Query of type Query

3

%Query_View

Query of type View

4

%Query_Role

Role

5

%Query_DBAgent

Process

7

%Query_Archive

Archive

This property is read/write.