Query Properties

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

Within a query, you can set properties on the query itself, the data sources, the fields that are used for sorting, and the ranges that are used to delimit the query.

Query Properties

Query properties determine the overall behavior of the query. For example, it is possible to determine which form should be displayed to allow users to interact with the query.

Property

Description

New in this version of
 Microsoft Dynamics AX

AllowCheck

Ignored for queries. The AllowCheck property is effective on forms and reports.

AllowCrossCompany

Determines whether data is retrieved for all companies the user has authority to read from. The default is false, which means data is retrieved only for the current session company.

Description

Describes the query, what it returns, etc. This is useful in Office Add-in scenarios. Optional.

AX 2012

Form

Determines which query form MorphX should display when users interact with the query. The default is SysQueryForm.

Interactive

Determines whether users can interact with the report by delimiting queries and setting printer options and so on.

Literals

Determines how literals are represented in SQL statements.

The forceLiterals statement instructs the kernel to reveal the actual values that are used in where clauses to the Microsoft SQL server database at the time of optimization. The forcePlaceholders statement instructs the kernel not to reveal the actual values.

Note   You are advised not to use the forceLiterals option, because it could expose code to an SQL injection security threat.

Model

Specifies which model the query is in.

A model is a logical grouping of elements in a layer. An element can exist in exactly one model in a layer. Examples of elements are a table or class. The same element can exist in a customized version in a model in a higher layer.

AX 2012

QueryType

Specifies the type of the query. The options are:

  • Join

  • Union

The default value is Join.

AX 2012

Searchable

Specifies whether the query can be made part of a set of queries to be used for searching the Sharepoint Business Catalog. Useful in connection with the Enterprise Search feature.

The default value is No.

AX 2012

Title

Heading for the query.

UserUpdate

Determines whether the query form should retain its state when it is reopened.

If set to Yes, the previous settings are restored. If set to No, it is only possible to view the data; editing is forbidden.

Version

Read-only property. The version is increased every time the query is updated.

Data Source Properties

The following properties control the characteristics of a data source. Additional properties are available on embedded data sources and relations between data sources. You can also set one property on fields in the data source.

Property

Available on

Description

AllowAdd

Data source

Determines whether users can add fields to sorting and to ranges at run time.

Company

Data source

Determines which company to retrieve data from.

Dynamic

Fields node in a data source

Determines whether all fields in the table in the data source are used.

If set to Yes, all the fields in the data source are used. If set to No, you can remove some of the fields.

When the data source is a base table, Yes means that all fields from the derived tables are used. For more information, see Selecting Data from a Table Inheritance Hierarchy.

Enabled

Data source

If set to No, the data source (and all embedded data sources) are ignored.

FetchMode

Embedded data source

Determines whether the data sources should be related through a 1:1 relation or a 1:n relation.

Note

For data sources used in reports, use a join relation with 1:1 fetch mode.

Field, RelatedField

Relations on an embedded data source

The name of the fields from the parent data source and related data source that are used in the relation.

FirstFast

Data source

If set to Yes, the database receives a hint that the first record from the query should be retrieved before the other records. This allows some database systems to optimize record retrieval, and thus improve performance.

FirstOnly

Data source

If set to Yes, the database receives a hint that only the first record from the query is required. This allows some database systems to optimize record retrieval, and thus improve performance.

JoinMode

Embedded data source

Determines the strategy for how to join the output from a data source.

For more information about join types, see How to: Add Multiple Data Sources to a Query.

Name

Data source

Determines the name of the data source.

Relations

Embedded data source

Determines if the query system should use the relations that are defined for tables and extended data types.

If set to Yes, the query is automatically updated if a relation is changed.

Table

Data source

Determines the table, map, or view that is used as a data source.

This property cannot be modified after a sorting order or a range has been defined.

Table, RelatedTable

Relations on an embedded data source

The name of the parent data source and the related data source.

UniqueId

Data source

Unique number for the data source (read-only).

Update

Data source

Determines whether the query is allowed to update records in the database.

Range Properties

The following properties determine the characteristics of the range specification. For example, you can decide whether users are allowed to modify the range at run time.

Property

Description

Enabled

Allows you to disable a field in a range specification.

Field

Specifies which field to define a range on.

Label

Allows you to enter a label for the range.

Status

Determines if users are allowed to modify the range in the query dialog at run time. Possible options are Open, Lock, or Hide. If the field is open, users can view and edit the range. If the field is locked, users can only view the range. If the field is hidden, the range cannot be seen or edited.

Value

Specifies the range for the retrieved records. If using enums, do not use text strings. The enum ID must be used.

For information about the values you can enter for a range, see Query Elements in the AOT and Using Expressions in Query Ranges.

See also

Accessing Data

System and Common Properties

Using Expressions in Query Ranges