QueryRun Class
The QueryRun class traverses tables in the database, fetches records that satisfy constraints that are given by the user, and helps to gather such constraints from user input.
Syntax
class QueryRun extends ObjectRun
Run On
Called
Methods
Method | Description | |
---|---|---|
addPageRange | ||
allowCheck | ||
allowCrossCompany | ||
applyValueBasedPaging | ||
args | Returns the arguments that the object was constructed with. (Inherited from ObjectRun.) | |
attach | Reverses a call to the method. This is the reverse of calling the ObjectRun.detach method. Reversing the call disallows any further switching of focus between windows. (Inherited from ObjectRun.) | |
cancelTimeOut | Cancels a previous method call to the setTimeOut method. (Inherited from Object.) | |
canPage | ||
changed | Determines whether the specified data source has fetched a new value since the last call to the QueryRun.next method. | |
changedBy | Gets or sets the name of the user who last changed the application object. | |
changedDate | Gets or sets the date an application object was last changed. | |
changedNo | ||
changedTime | Gets or sets the time an application object was last changed. | |
createdBy | Gets or sets the name of the user who created the application object. | |
creationDate | Gets or sets the date an application object was created. | |
creationTime | ||
description | ||
detach | Allows focus to be switched between windows. (Inherited from ObjectRun.) | |
enablePositionPaging | ||
enableValueBasedPaging | ||
equal | Determines whether the specified object is equal to the current object. (Overrides the equal Method.) | |
form | ||
get | Retrieves the record fetched by the previous call to next method. | |
getNo | Retrieves the record fetched by the previous call to QueryRun.next Method. | |
getTimeOutTimerHandle | Returns the timer handle for the object. (Inherited from Object.) | |
handle | Retrieves the handle of the class of the object. (Inherited from Object.) | |
init | ||
interactive | ||
isDetached | Communicates whether an ObjectRun.detach method call has been made on this object. (Inherited from ObjectRun.) | |
isPositionPagingEnabled | ||
isQueryTimedout | ||
isValueBasedPagingEnabled | ||
literals | ||
name | Gets or sets the name that is used in code to identify a form, report, table, query, or another Microsoft Dynamics AX application object. | |
new | Initializes a new instance of the Object class. (Overrides the new Method.) | |
newObject | ||
next | Retrieves the next record from the query. | |
nextUniqueId | ||
notify | Releases the hold on an object that has called the wait method on this object. (Inherited from Object.) | |
notifyAll | Releases a lock on the object that was issued by the wait method on this object. (Inherited from Object.) | |
objectOnServer | Determines whether the object is on a server. (Inherited from Object.) | |
origin | ||
owner | Returns the instance that owns the object. (Inherited from Object.) | |
pack | ||
prompt | Presents, to the user, the options for defining the records to be fetched by the query. | |
query | ||
queryType | ||
recordLevelSecurity | ||
report | ||
reportRun | ||
reset | ||
run | Opens a form used to obtain information about the query from the user, and fetches the matching records. | |
saved | ||
saveUserSetup | Saves the user setup. | |
searchable | ||
setCursor | ||
setQuerytimeout | ||
setRecord | ||
setTimeOut | Sets up the scheduled execution of a specified method. (Inherited from Object.) | |
title | ||
toString | Returns a string that represents the current object. (Overrides the toString Method.) | |
usageCount | Returns the current number of references, that is, the value of the reference counter, that the object has. (Inherited from Object.) | |
userUpdate | ||
version | ||
wait | Pauses a process. (Inherited from Object.) | |
xml | Returns an XML string that represents the current object. (Inherited from Object.) | |
::getQueryRowCount |
Top
Remarks
QueryRun objects are used to traverse tables in the database and fetch records that satisfy the constraints that are given by the user. A QueryRun object may interact with the user to let the user enter such constraints.
Queries are used internally by reports to delineate and fetch the data to be presented in the report. A QueryRun object relies on a Query object to define the structure of the query (for example, which tables are searched and how the records are sorted). A QueryRun object defines the dynamic behavior of the query, whereas a Query object defines the static characteristics of the query.
Examples
In the following example, it is assumed that there is a query named Customer in the Microsoft Dynamics AX Application Object Tree (AOT), and that it has one data source, the CustTable table.
static void example()
{
// Create a QueryRun object from a query stored in the AOT.
QueryRun qr = new QueryRun ("Customer");
CustTable customerRecord;
// Display a window enabling the user to choose which records to print.
if (qr.prompt())
{
// The user clicked OK.
while (qr.next())
{
// Get the fetched record.
CustomerRecord = qr.GetNo(1);
// Do something with it
print CustomerRecord.AccountNum;
}
}
else
{
// The user pressed Cancel, so do nothing.
}
}
Inheritance Hierarchy
Object Class
ObjectRun Class
QueryRun Class
SysQueryRun Class