Query Class

Definition

The Query class embodies the structure of a query.

public ref class Query : Dynamics::AX::Application::TreeNode
[Microsoft.Dynamics.Ax.Xpp.KernelClass]
public class Query : Dynamics.AX.Application.TreeNode
[<Microsoft.Dynamics.Ax.Xpp.KernelClass>]
type Query = class
    inherit TreeNode
Public Class Query
Inherits TreeNode
Inheritance
Microsoft.Dynamics.AX.KernelInterop.ProxyBase
Query
Attributes

Remarks

Objects of this kind are not used to fetch records from the database. Instead, use a QueryRun object that can be assigned a query object. The dynamic behavior of a query is defined by the QueryRun class. The static behavior is defined by the Query class. Queries contain one or more data sources that correspond to tables in the database. The data sources are specified by using QueryBuildDataSource objects. This class lets you create, read, update, and delete X++ code and metadata. Make sure that the user has access to the development security key (SysDevelopment) before this API is called. Queries are used when the user wants to modify the records that are fetched by, for example, a form. One or more ranges are often added to an existing data source. Ranges are specified by using queryBuildRange objects.

The following example creates a query object that is used to create a QueryRun object.

{ 
    Query q = new Query (QueryStr(Cust)); 
    // Use the query to build a queryRun object. 
    QueryRun qr = new QueryRun (q); 
    // Traverse some records. 
    while (qr.next()) 
    { 
        // ... 
    } 
}

Constructors

Query()
Query(IntPtr)
Query(Object)
Query(Object, Boolean)

Fields

kernelClass (Inherited from XppObjectBase)

Methods

__shouldCallNew(Type)
addBaseQuery(String)
addCompanyRange(String)
addContains(String)
addContains(String, Boolean)
addDataSource(Int32)

Adds a data source to the top level of the query.

addDataSource(Int32, String)
addDataSource(Int32, String, UnionType)
addDataSource(Int32, String, UnionType, Boolean)
addHavingFilter(QueryBuildDataSource, String, AggregateFunction)
addHavingFilter(QueryBuildDataSource, String, AggregateFunction, Int32)
addQueryFilter(QueryBuildDataSource, String)
addQueryFilter(QueryBuildDataSource, String, Int32)
addXppProxyReference(Type, Object) (Inherited from XppObjectBase)
allowCheck()
allowCheck(Boolean)
allowCrossCompany()
allowCrossCompany(Boolean)
allowHavingFilters(QueryBuildDataSource, String, AggregateFunction)
allowQueryFilters(QueryBuildDataSource)
AOTadd(String) (Inherited from TreeNode)
AOTaddExtendedDataType(String, Types) (Inherited from TreeNode)
AOTaddRelation() (Inherited from TreeNode)
AOTaddSubNode(Int32) (Inherited from TreeNode)
AOTaddXref(String, xRefKind, Int32, Int32) (Inherited from TreeNode)
AOTaddXref(String, xRefKind, Int32, Int32, XRefReference) (Inherited from TreeNode)
AOTaddXref(String, xRefKind, Int32, Int32, XRefReference, Int32) (Inherited from TreeNode)
AOTAllowEdit() (Inherited from TreeNode)
AOTbitmapId()

Returns the resource ID of the bitmap of the tree node.

(Inherited from TreeNode)
AOTchildNodeCount()

Counts the number of child nodes that a given tree node has.

(Inherited from TreeNode)
AOTcompile() (Inherited from TreeNode)
AOTcompile(Int32) (Inherited from TreeNode)
AOTcompile(Int32, Boolean) (Inherited from TreeNode)
AOTcompile(Int32, Boolean, Boolean) (Inherited from TreeNode)
AOTconfigure() (Inherited from TreeNode)
AOTdelete() (Inherited from TreeNode)
AOTDrop(TreeNode)

Creates a copy of a specified tree node as a child to the TreeNode object.

(Inherited from TreeNode)
AOTDrop(TreeNode, TreeNode) (Inherited from TreeNode)
AOTDuplicate() (Inherited from TreeNode)
AOTedit()

Opens the appropriate editor for this node.

(Inherited from TreeNode)
AOTedit(Int32) (Inherited from TreeNode)
AOTedit(Int32, Int32) (Inherited from TreeNode)
AOTendXref() (Inherited from TreeNode)
AOTfindChild(String)

Finds the specified child node of this node.

(Inherited from TreeNode)
AOTfindChild(String, Int32) (Inherited from TreeNode)
AOTfirstChild()

Retrieves the first child of the tree node.

(Inherited from TreeNode)
AOTfirstChildEx() (Inherited from TreeNode)
AOTfirstChildEx(Boolean) (Inherited from TreeNode)
AOTgetExecutableLineCount()

Returns the number of executable lines of code for this node.

(Inherited from TreeNode)
AOTgetExecutableLines()

Returns the executable lines of code for this node.

(Inherited from TreeNode)
AOTGetModel() (Inherited from TreeNode)
AOTgetProperties()

Returns a string containing the properties of the tree node.

(Inherited from TreeNode)
AOTgetProperties(Boolean) (Inherited from TreeNode)
AOTgetProperties(Boolean, Boolean) (Inherited from TreeNode)
AOTgetProperties(Boolean, Boolean, Boolean) (Inherited from TreeNode)
AOTgetPropertiesExt() (Inherited from TreeNode)
AOTgetPropertiesExt(String) (Inherited from TreeNode)
AOTgetProperty(String)
AOTgetSource()

Returns the source code of this node.

(Inherited from TreeNode)
AOTIncludeInCompare() (Inherited from TreeNode)
AOTinsert(TreeNode)

Inserts a node among the subnodes of this node.

(Inherited from TreeNode)
AOTinsert(TreeNode, TreeNode) (Inherited from TreeNode)
AOTinsert(TreeNode, TreeNode, Boolean) (Inherited from TreeNode)
AOTIsDirty() (Inherited from TreeNode)
AOTIsOld()

Indicates whether this node is from a file found in the old model store.

(Inherited from TreeNode)
AOTIsPersisted()

Indicates whether this node has been persisted in the model store.

(Inherited from TreeNode)
AOTIsProxyNode() (Inherited from TreeNode)
AOTiterator()

Returns an object which can be used to iterate the child nodes of the tree node.

(Inherited from TreeNode)
AOTKernelHelpType() (Inherited from TreeNode)
AOTLayer()

Returns the layer of the tree node.

(Inherited from TreeNode)
AOTLayers()

Returns a collection of the layers the tree node is defined in.

(Inherited from TreeNode)
AOTLayers(Boolean) (Inherited from TreeNode)
AOTload()

Ensures that the object is loaded.

(Inherited from TreeNode)
AOTmakeXref()

Compiles this node and its subtree in the AOT, updating the cross-reference system.

(Inherited from TreeNode)
AOTmakeXref(Int32) (Inherited from TreeNode)
AOTmakeXref(Int32, Boolean) (Inherited from TreeNode)
AOTmessageLine(String, Int32)

Writes text to the Application Object Tree (AOT) Message window.

(Inherited from TreeNode)
AOTMove(TreeNode) (Inherited from TreeNode)
AOTMove(TreeNode, TreeNode) (Inherited from TreeNode)
AOTname()
AOTnewWindow()

Opens a new AOT tree window with the tree node as the root.

(Inherited from TreeNode)
AOTnextSibling()

Returns the next node on the same level as the tree node.

(Inherited from TreeNode)
AOTObjectNode()

Indicates whether the node is an application object.

(Inherited from TreeNode)
AOToverlayBitmapId()

Returns the resource ID of the overlay in the AOT associated with this node.

(Inherited from TreeNode)
AOTparent()

Returns the parent node of the tree node.

(Inherited from TreeNode)
AOTprevious()

Returns the previous sibling of this tree node.

(Inherited from TreeNode)
AOTrefresh()

Refreshes the node with the latest changes to the .aod file.

(Inherited from TreeNode)
AOTregenerate() (Inherited from TreeNode)
AOTRename(String) (Inherited from TreeNode)
AOTrestore()

Reloads this node from the disk, if applicable.

(Inherited from TreeNode)
AOTrestore(Boolean) (Inherited from TreeNode)
AOTrun()

Compiles this node and its subtree in the Application Object Tree (AOT).

(Inherited from TreeNode)
AOTrun(xArgs) (Inherited from TreeNode)
AOTsave() (Inherited from TreeNode)
AOTSetModel(Int32) (Inherited from TreeNode)
AOTsetProperties(String) (Inherited from TreeNode)
AOTsetPropertiesExt(Struct) (Inherited from TreeNode)
AOTsetProperty(String, Object) (Inherited from TreeNode)
AOTsetSource(String) (Inherited from TreeNode)
AOTsetSource(String, Boolean) (Inherited from TreeNode)
AOTshowProperties()

Opens the property sheet (if not already open) and shows the properties for this node.

(Inherited from TreeNode)
AOTtoolTip()

Returns the tool tip associated with the tree node.

(Inherited from TreeNode)
AOTToString() (Inherited from TreeNode)
AOTtypeStr()

Returns the internal string code for the element type used in XPO files.

(Inherited from TreeNode)
AOTUtilFileType()

Retrieves the value of the UtilFileType enumeration type for the TreeNode object. The UtilFileType indicates which kind of file the application object is stored in.

(Inherited from TreeNode)
applObjectId()

Returns the application object ID, if applicable.

(Inherited from TreeNode)
applObjectLayerMask()

Returns a bitmask that specifies which layers contain this element.

(Inherited from TreeNode)
applObjectOldLayerMask()

Returns a bitmask that specifies which layers contain this element in the baseline model store.

(Inherited from TreeNode)
applySelectHints()
Call(String, Object[], Type[], Object[]) (Inherited from XppObjectBase)
cancelTimeOut(Int32) (Inherited from XppObjectBase)
changedBy()

Gets or sets the name of the user who last changed the Query object.

changedBy(String)
changedDate()

Gets or sets the date an application object was last changed.

changedDate(Date)
changedTime()

Gets or sets the time an application object was last changed.

changedTime(String)
checkAuthorizationOnOpenRanges(Boolean)
checkFieldAccess(Boolean)
checkRangeParsingErrors(Boolean)
childDataSourceCount()

Counts the number of data sources that are related to the query.

childDataSourceNo(Int32)

Returns the child data source that corresponds to the specified number.

clearAllFields()
clearBaseQueries()
clearCompanyRange()
clearGroupBy()
clearHavingFilters()
clearHavingFilters(QueryBuildDataSource)
clearHavingFilters(QueryBuildDataSource, String)
clearHavingFilters(QueryBuildDataSource, String, Int32)
clearHavingFilters(QueryBuildDataSource, String, Int32, Int32)
clearOrderBy()
clearQueryFilter(QueryBuildDataSource, Int32)
clearQueryFilters()
clearQueryFilters(QueryBuildDataSource)
clearQueryFilters(QueryBuildDataSource, String)
clearQueryFilters(QueryBuildDataSource, String, Int32)
clearQueryFilters(QueryBuildDataSource, String, Int32, Int32)
clearQueryFiltersById(QueryBuildDataSource, Int32)
createdBy()

Gets or sets the name of the user who created the application object.

createdBy(String)
createKernelClass(Object[], Type[], Object[]) (Inherited from XppObjectBase)
creationDate()

Gets or sets the date an application object was created.

creationDate(Date)
creationTime()
creationTime(String)
dataSourceCount()

Returns the total number of data sources for the query, including any embedded data sources.

dataSourceName(String)

Returns the data source that has the specified name.

dataSourceNo(Int32)

Returns the data source that is specified by the data source number.

dataSourceTable(Int32)

Returns the data source that the specified table is assigned to.

dataSourceTable(Int32, Int32)
dataSourceUniqueId(Int32)
delete_from(Query)
delete_from(Query, Boolean)
delete_from(Query, Boolean, Boolean)
delete_from(Query, Boolean, Boolean, Boolean)
description()
description(String)
deserialize(String)
deserializeFromContainer(Object[])
equal(XppObjectBase)

Evaluates whether one query is equal to another.

exportXML()
finalize()
findHavingFilterByField(QueryBuildDataSource, String)
findHavingFilterByField(QueryBuildDataSource, String, Int32)
findHavingFilterByField(QueryBuildDataSource, String, Int32, Int32)
findQueryFilter(QueryBuildDataSource, String)
findQueryFilter(QueryBuildDataSource, String, Int32)
findQueryFilter(QueryBuildDataSource, String, Int32, Int32)
firstOnly1()
firstOnly1(Boolean)
firstOnly10()
firstOnly10(Boolean)
firstOnly100()
firstOnly100(Boolean)
firstOnly1000()
firstOnly1000(Boolean)
forceNestedLoop(Boolean)
forceSelectOrder(Boolean)
form()
form(String)
getCompanyRange()
GetIntPtr()
GetKernelInstanceUniqueId() (Inherited from XppObjectBase)
getMostRestrictedQueryFilterStatus(QueryBuildDataSource, String)
getMostRestrictedQueryFilterStatus(QueryBuildDataSource, String, Int32)
getNextUniqueId()
getNodeInLayer(UtilEntryLevel)

Retrieves a version of the tree node from a specified layer.

(Inherited from TreeNode)
getNodeInLayer(UtilEntryLevel, Boolean) (Inherited from TreeNode)
getSQLStatement()
getSQLStatement(Boolean)
getTimeOutTimerHandle() (Inherited from XppObjectBase)
getValidTimeStateDateRange()
getValidTimeStateDateTimeRange()
getValidTimeStateQueryType()
getXppProxyReference(Type) (Inherited from XppObjectBase)
groupByField(Int32)
groupByField(Int32, QueryBuildDataSource)
groupByFieldCount()
groupByFieldCount(QueryBuildDataSource)
handle()
hashKey() (Inherited from TreeNode)
hasRangeOrFilter(QueryBuildDataSource)
havingFilter(Int32)
havingFilter(Int32, QueryBuildDataSource)
havingFilterCount()
havingFilterCount(QueryBuildDataSource)
importSession()
importSession(Guid)
inReport()

Determines whether the query is part of a report.

insert_recordset(Common, Map, Query)
interactive()

Specifies whether the query is interactive.

interactive(Boolean)
isCompositeQuery()
IsManagedValid()
isPureUnionAll()
isUnionType()
kernelhandle()
KernelInstanceDisposed() (Inherited from XppObjectBase)
levelNo(Int32)

Determines the level of indentation of the specified data source.

levelTable(Int32)

Determines the tree level, in the hierarchy of data sources, of the data source that is assigned to the specified table.

levelTable(Int32, Int32)
literals()
literals(Int32)
makeCopy()
MakeReflectionCall(String, Object[]) (Inherited from XppObjectBase)
name()

Gets or sets the name that is used in code to identify a form, report, table, query, or another Finance and Operations application object.

name(String)
newmethod()

Creates a query object.

newmethod(Object)
newObject(Object)

Creates a query that exists on the same client side or server side as the source query.

newObjectName()

Returns a string that contains the name of the new element.

(Inherited from TreeNode)
newObjectName(String) (Inherited from TreeNode)
nextUniqueId()
nextUniqueId(Int32)
normalizeQuery(Int32)
notify() (Inherited from XppObjectBase)
notifyAll() (Inherited from XppObjectBase)
objectOnServer()
Obsolete.
(Inherited from XppObjectBase)
orderByField(Int32)
orderByField(Int32, QueryBuildDataSource)
orderByFieldCount()
orderByFieldCount(QueryBuildDataSource)
origin()
origin(Guid)
pack()

Packs the query into a container and returns that container, so that it can be used when you create a query.

pack(Boolean)
packInternals()
queryFilter(Int32)
queryFilter(Int32, QueryBuildDataSource)
queryFilterCount()
queryFilterCount(QueryBuildDataSource)
queryType()
queryType(Int32)
quickFilterControlId()
quickFilterValue()
recordLevelSecurity()
recordLevelSecurity(Boolean)
report()

Returns the report in which the query is defined, if the report exists.

resetValidTimeStateQueryType()
saved()

Indicates whether the query has been saved to disk.

searchable()
searchable(Boolean)
selectHintsString()
serialize()
serializeToContainer()
setSqlRecompileHint()
setTimeOut(String, Int32)
Obsolete.
(Inherited from XppObjectBase)
setTimeOut(String, Int32, Boolean)
Obsolete.
(Inherited from XppObjectBase)
setValidTimeStateQueryType(ValidTimeStateQueryType)
skipAutoOrderBy()
skipAutoOrderBy(Boolean)
title()
title(String)
topRows()
topRows(Int32)
ToString()

Returns a string that represents the current object.

treeNodeExport(String)

Exports this node and its subtree from the Application Object Tree (AOT).

(Inherited from TreeNode)
treeNodeExport(String, Int32) (Inherited from TreeNode)
treeNodeName()

Returns the name of the tree node.

(Inherited from TreeNode)
treeNodePath()

Returns the unique path to the tree node within the Application Object Tree (AOT).

(Inherited from TreeNode)
treeNodeRelease()

Releases the tree node explicitly.

(Inherited from TreeNode)
treeNodeType()

Retrieves an instance of a TreeNodeType class that provides reflection information for the tree node.

(Inherited from TreeNode)
unpackInternals(Object[])
update_recordset(Map, Query)
update_recordset(Map, Query, Boolean)
update_recordset(Map, Query, Boolean, Boolean)
update_recordset(Map, Query, Boolean, Boolean, Boolean)
updateNodePermissions(Boolean) (Inherited from TreeNode)
usageCount() (Inherited from XppObjectBase)
useDbCacheOnGeneratedCursors(Int32)
userUpdate()

Gets or sets a value that indicates whether the query can update the records that it fetches.

userUpdate(Boolean)
utilElement()

Returns a UtilElements record that is related to the node.

(Inherited from TreeNode)
utilIdElement()

Returns a UtilIdElements record that is related to the node.

(Inherited from TreeNode)
validateNameCharacters(String) (Inherited from TreeNode)
validTimeStateAsOfDate()
validTimeStateAsOfDate(Date)
validTimeStateAsOfDateTime()
validTimeStateAsOfDateTime(utcdatetime)
validTimeStateDateRange()
validTimeStateDateRange(Date)
validTimeStateDateRange(Date, Date)
validTimeStateDateTimeRange()
validTimeStateDateTimeRange(utcdatetime)
validTimeStateDateTimeRange(utcdatetime, utcdatetime)
VerifyKernelClass() (Inherited from XppObjectBase)
version()
version(Int32)
wait() (Inherited from XppObjectBase)
Xml()

Returns an XML string that represents the current object.

Xml(Int32)

Applies to