QuerySelect Methods

In this section, we discuss each QuerySelect method. The methods are arranged in alphabetical order.

Syntax

AddAllFields(QueryRecord)

Description

The AddAllFields method adds all the fields in the specified query record to the query definition, that is, makes them all QueryOutputFields. The query record must already be a part of the query definition.

Parameters

Field or Control

Definition

QueryRecord

Specify the instance of an existing record in the query from which you want to add all the fields from to the query definition. This instance can be obtained from the QueryRecords collection of the QuerySelect.

Returns

An integer: 0 if successfully added.

Syntax

AddCriteria(Name)

Description

The AddCriteria method adds new criterion to the query definition. This method returns a reference to a new QueryCriteria object that you can then use to specify details about the criteria.

Note: If you do not specify a unique name for Name when adding a criteria, a criteria object referencing the new criteria is returned, not the existing criteria object.

Parameters

Field or Control

Definition

Name

Specify a string containing the name of the criteria that you want to add. The maximum length of this parameter is 30 characters.

Returns

A reference to a QueryCriteria object.

Syntax

AddExpression(Name)

Description

The AddExpression method adds an expression to the query definition. It returns a reference to a new QueryExpression object you can use to specify details about the expression.

Parameters

Field or Control

Definition

Name

Specify a string containing the name of the expression that you want to add. This maximum length of this parameter is 30 characters.

Returns

A reference to a QueryExpression object.

Syntax

AddHavingCriteria(Name)

Description

The AddHavingCriteria method adds new criterion to the query definition, which is intended for use in the HAVING clause of the SELECT statement. This method returns a reference to a new QueryCriteria object that you can then use to specify details about the having criteria.

Note: If you do not specify a unique name for Name when adding a criterion, a criteria object referencing the new criteria is returned, not the existing criteria object.

Parameters

Field or Control

Definition

Name

Specify a string containing the name of the criteria that you want to add. The maximum length of this parameter is 30 characters.

Returns

A reference to a QueryCriteria object.

Syntax

AddQueryOutputField(QueryRecord, index)

Description

The AddQueryOutputField method adds a query output field to the query definition. This method returns a reference to a new QueryOutputField object that you can then use to specify attributes for the query definition.

Parameters

Field or Control

Definition

QueryRecord

Specify the QueryRecord instance that contains the field that you want to include in the query definition. This instance can be obtained from the QueryRecords collection of the QuerySelect.

Index

Specify the numeric position in the QueryRecord of the field that you want to add.

Returns

A reference to a QueryOutputField object.

Syntax

AddQueryRecord(QueryRecordName)

Description

The AddQueryRecord method adds a query record to the query definition. You must specify a valid record name in the string parameter QueryRecordName. This method returns a reference to the record as a QueryRecord.

Parameters

Field or Control

Definition

QueryRecordName

Specify a string containing the name of a record to be added to the query definition. You must specify a valid record name. The maximum allowed length for this parameter is 15 characters.

Returns

A reference to the record as a QueryRecord object.

Syntax

AddQuerySelectedField(QueryRecordName, RecordAlias, FieldName, Heading)

Description

The AddQuerySelectedField method adds a query field to the query definition, as a QuerySelectedField. This method returns a reference to a new QuerySelectedField object that you can then use to specify attributes for the query definition. At the time it's added, it isn't an output field. This can be changed by setting the column number of the field to a value greater than zero.

Parameters

Field or Control

Definition

QueryRecordName

Specify the name of the query record to which the field that you want to add belongs.

RecordAlias

Specify the alias of the record (such as A, B, C, and so on.) The length of this parameter is 1.

FieldName

Specify the name of the field that's being added. The maximum allowed length for a field name is 18 characters.

Heading

Specify the heading of the field that's being added. The maximum allowed length for a heading is 30 characters.

Returns

A reference to a QuerySelectedField object.

Syntax

DeleteCriteria(index)

Description

The DeleteCriteria method deletes the criteria specified by index from the query definition.

Parameters

Field or Control

Definition

Index

Specify the numeric position in the query definition of the criteria that you want to delete.

Returns

An integer: 0 if successfully deleted.

Syntax

DeleteExpression(index)

Description

The DeleteExpression method deletes the specified expression from the query definition.

Parameters

Field or Control

Definition

Index

Specify the numeric position of the expression in the query definition that you want to delete.

Returns

An integer: 0 if successfully deleted.

Syntax

DeleteField(index)

Description

The DeleteField method deletes the selected field from the query definition. This does not delete the field from the QueryRecord, just from the query definition, so it's no longer selected.

Parameters

Field or Control

Definition

Index

Specify the position number of the field that you want deleted from the query definition.

Returns

An integer: 0 if successfully deleted.

Syntax

DeleteHavingCriteria(index)

Description

The DeleteHavingCriteria method deletes the having criteria specified by index from the query definition.

Parameters

Field or Control

Definition

Index

Specify the numeric position in the query definition of the having criteria that you want to delete.

Returns

An integer value: 0 means the having criteria was deleted successfully.

Syntax

DeleteRecord(index)

Description

The DeleteRecord method deletes the selected record from the query definition. This does not delete the record from the database or the QueryDBRecord collection, just from the query definition, so it's no longer selected.

Parameters

Field or Control

Definition

Index

Specify the position number of the record you want deleted from the query definition.

Returns

An integer: 0 if successfully deleted.