QuerySelect Collection Methods

In this section, we discuss the QuerySelect collection methods. The methods are discussed in alphabetical order.

Syntax

AddUnion()

Description

The AddUnion method adds a new QuerySelect object of type Union in the current QuerySelect collection. You can use AddUnion only with the first QuerySelect Collection because PeopleSoft Query doesn’t' support Unions for subqueries. All unions are considered children of the Main Select.

Parameters

None.

Returns

A reference to a QuerySelect object if successful. If the current QuerySelect Collection does not belong to the first Select statement, it returns NULL. If it fails, it returns NULL.

Example

&QryMainSel = &Query.QuerySelect; 
&QryMainSelCol = &QryMainSel.QuerySelects; 
&QryUnion = &QryMainSelCol.AddUnion();

Syntax

DeleteQuerySelect(SelNumber)

Description

The DeleteQuerySelect method deletes the QuerySelect instance represented SelNumber.

Parameters

Field or Control

Definition

SelNumber

Specify the numeric value containing the Select Number of the QuerySelect that you want to delete.

Returns

Returns 0 if successful.

Example

&QryMainSel = &Query.QuerySelect; 
&QryMainSelCol = &QryMainSel.QuerySelects; 
&QryMainSelCol.DeleteQuerySelect(3);

Syntax

First()

Description

The First method returns the first child QuerySelect object in the current QuerySelect’s collection.

Parameters

None.

Returns

A reference to a QuerySelect object if successful, NULL otherwise.

Example

&MyChildQrySel = &MySelCollection.First();

Syntax

Item(number)

Description

The Item method returns the QuerySelect object that exists at the number position in the current QuerySelect collection.

Parameters

Field or Control

Definition

Number

Specify the position number in the collection of the QuerySelect object that you want returned.

Returns

A reference to a QuerySelect object if successful, NULL otherwise.

Example

For &I = 1 to &QrySelCol.Count; 
   &MyChildQrySel = &QrySelCol.Item(&I); 
   /* do processing */ 
End-For;

Syntax

ItemBySelNum(SelNumber)

Description

The ItemBySelNum method returns the QuerySelect object specified by the Select Number. Each Select Statement in a Query Definition is identified by a unique select number.

Parameters

Field or Control

Definition

SelNumber

Specify the numeric value of the Select Number.

Returns

A reference to a QuerySelect object if successful, NULL otherwise.

Example

&MyChildQuerySelect = &MySelCol.ItemBySelNum(3);

Syntax

Next()

Description

The Next method returns the next QuerySelect object in the current QuerySelect collection. You can use this method only after you have used the First method: otherwise the system returns a NULL.

Parameters

None.

Returns

A reference to a QuerySelect object if successful, NULL otherwise.

Example

&MyChildQuerySelect = &MySelCol.Next();