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

Notifications

Announcements

No record found.

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
    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
    237,807 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans