<OBJECT>.QUERYRUN()

Syntax

Record_Count as N = <OBJECT>.QUERYRUN( Filter_Expression as C  [, Order_Expression as C [, Query_Description as C [, Additive as C [, Level_Name as C [, Display_Warning as L [, Query_Options as C ]]]]]] )

Argument

Description

Record_Count

The number of records found by the query.

Filter_Expression

An expression that selects records from the table.

Order_Expression

Optional. Default = Record order. An expression that orders the records selected.

Query_Description

Optional. The name of the query. Use "Temporary Query" to define a query that Alpha Five can discard to make room for new queries.

Additive

Optional. Default = "No".

  • "Yes" = The query is in addition to the form's current query.

  • "No" = The query replaces the form's currency query.

Level_Name

Optional. Default = "crosslevel". The name of the parent table when the Filter_Expression is based on the child table or the parent and child tables where there is a one-to-many relationship between the parent and child tables.

Display_Warning

Optional. Default = .F. (FALSE). If no records are found, whether to display a warning.

Query_Options

Optional. Default = "". Refer to <TBL>.QUERY_CREATE().

Description

The <OBJECT>.QUERYRUN() method applies to:

The <OBJECT>.QUERYRUN() method applies a query to the current layout. The method returns the number of records selected by the query.

Supported By

Alpha Five Version 5 and Above

Limitations

Desktop applications only.

Example

The current script opens a form and only displays records from Massachusetts:

dim P as P

P = form.load("customer information")

Result = p.QueryRun("bill_state_region = 'ma'")

if (result = 0) then

    ui_msg_box("Error","No records found")

    p.close()

else

    p.activate()

end if

To modify the above script to sort the result by lastname, change the .QUERYRUN() method to:

Result = p.QueryRun("bill_state_region = 'ma'", "lastname")

The following script applies a filter additively. The script is attached to a button on a form:

Old_filter = topparent.filter_get()

Topparent.QueryRun("lastname = 'smith'", "", "", "Yes")

'To "undo" the last query:

Topparent.QueryRun(old_filter)

See Also

Form Functions and Methods, Browse Functions and Methods