web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Best Practice for Working with data in AX 2012

(0) ShareShare
ReportReport
Posted on by 928

Hi All,

I am currently learning AX 2012. Today I found that there are three different way to work with data. 

1.  While Select - Tables as Object. (Easy one)

2. AOT Queries- In AOT Groups

3. Query Objects-

What are their individual features, limitation and uses?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Jie G Profile Picture
    Microsoft Employee on at

    While Select is used to loop over many records that meet specific criteria, and can run a statement on each record. The results of a while select statement are returned in a table buffer variable.

    AOT Query can be used to query the data using specified filters. You don't need to write the query statement many times and can be reused.

    Query object is a query created in runtime. it can be used in the lifecycle of the execution.

    Reference:

    docs.microsoft.com/.../xpp-data-query

    msdn.microsoft.com/.../bb314753.aspx

    community.dynamics.com/.../exploring-aot-query-s

    msdn.microsoft.com/.../query.aspx

  • Verified answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    Using query objects in code gives you some flexibility in comparison with select statements, e.g. you can use an if statement with a complex condition and add an additional datasource to the query if the condition is met. On the other hand, select statements are easier to write and read.

    You can also use these objects as method parameters or return values.

    You also need to use these objects if you want to modify form queries, for example.

    Queries modeled in AOT can be used in other AOT elements, such as in views. Also note that you can easily create query classes from AOT queries (new Query(queryStr(MyAOTQuery))), therefore you can have a certain "base" version in AOT and modify it at runtime as needed.

  • Khurshid Wali Profile Picture
    928 on at

    Thank you Ada Ding and Martin Drab!

    Please suggest any good resource to learn Query Objects.. query created in run time.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans