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)

Difference between Job and Query

(0) ShareShare
ReportReport
Posted on by

Hello!

What is the difference between those two stuff? When should I use first or second instead of just method on my object?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,884 Most Valuable Professional on at

    You're comparing apples, oranges and locomotives.

    A job is an executable piece of code, almost as a class with a single main method.

    A query is used for reading data from database.

    Neither is a replacement for an instance method.

  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Job:

    piece of code, used/recommended for testing purpose. Testing refer to testing of anything. e.g. I want to test Numerals2Text, I may use a job for its testing.

    Technically jobs can work for  real world practical tasks also, but recommend only for testing purpose.

    in short you code for testing is usually I jobs.

    Query:


    Query has same concept as it has in any structure query language. it can be used for multiple purposes. you can use it behind any report, behind nay view, behind any form.  

  • Community Member Profile Picture
    on at

    "You're comparing apples, oranges and locomotives" -Good one :)

    1) So Jobs are more like sub -programs with ability to live independently or as a part of some workflow?

    2) Why should I use Queries if I can type X++ code (I mean this "t-SQL-style" code) in any place I want to?

  • Verified answer
    Martin Dráb Profile Picture
    237,884 Most Valuable Professional on at

    1) Jobs are not used for any production code and no product should be shipped with them. Use them only in development if you want to try something.

    2) Queries integrated in X++ are still queries, nevertheless you seems to be asking why to use the query framework, such as queries in AOT and the Query class. The answer is reusability and extensibility. You can use such queries as form and report data sources, you can add ranges and data sources at runtime etc. Try the same with a select statement. :)

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