Ax - Create Static Query - using AOT Morphx

 Queries - a (one) way of retreiving data from the data base.

How to get data in AX: 1. Views, 2.Queries  3.Select statement.

Why Queries?

  helps when ranges or values are not known until run time.

Where used?

in forms + reports + places where data is retreived from multiple data sources.

How to create?

         1. AOT > Queries : (aka static queries) this node has predefined static queries, and you can add queries (Right Click on AOT\Queries node >Add Query)

Methods: customize or override methods of QueryRun class

DataSources: can be table, map, view --- and each of them can be nested as parent and child

Fields: check the Dynamics[property] : Yes mean all fields are displayed; No means you can pick fields

Range: to limit records for a given Range expression. ex: "1000" "1000..3000" "<2000" ">=4000" etc

GroupBy: only specific field combinations.

OrderBy: sort order to sort results. ex: ascending descending.

DataSources: can nest multiple data sources and link them using relations. (see pic below)

Relations: to set the join mode between the tables like Inner, Outer etc.

Dependent Object: All AOT nodes that refer the query are displayed here. ex: Forms, reports and other affected objects.

Composite Query: query based on another query. It is like inheritance. Usually used to override or add further ranges.

         2. x++ dynamic Queries:

check the next blog post.