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

  • Verified answer
    Martin Dráb Profile Picture
    233,488 Most Valuable Professional on at
    RE: Difference between Job and Query

    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. :)

  • Community Member Profile Picture
    on at
    RE: Difference between Job and Query

    "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
    Sohaib Cheema Profile Picture
    46,614 User Group Leader on at
    RE: Difference between Job and Query

    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.  

  • Verified answer
    Martin Dráb Profile Picture
    233,488 Most Valuable Professional on at
    RE: Difference between Job and Query

    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.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
shanawaz davood basha Profile Picture

shanawaz davood basha 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans