Query and Views

Hello All,

As per AOT Structure, there are two entities in tree.

  1. Query


Query can have one or more dataSources and main use for sorting and ranges.

View too can have multiple DataSources and stored at database to enhance the performance.

I would like to know, Why Do we need Query in AX, when we have Views in place? or this is because of security concern?

or is there any specific advantage of have Query ?

Thanks in advance.


Hi Neetu,

I would say queries are used majorly for reporting purposes. It can’t be said as ‘always’ but yes since I have been involved with reporting for quite some time I have used them therein. Except this, I have not encountered them so far. It might be used somwhere else too but I am not really sure.


Hi neetu,

QUERIES:: As preeti said queries are mainly used for reporting purpose…the main adavantage of query is filteration means if there are lot of records but u want some records based on conditions in that time u prefer queries…in queries we write logic and fetch the recors based on conditions…

VIEWS:: Views are mainly used for viewing purpose only we can’t create,update records in views…means if u want 2 fields from one table,3 fields from another table another 2 fieds from someanother table in that time views are useful…all these tables we added in views and then added fields into views …

A view isn’t stored as a database object (like a table) but is dynamically created when the view is accessed. A view uses a query to retrieve data fields from one or more database tables.

Views can be used in the same way as tables: in forms, reports, and from X++ code. View elements are instantiated in X++ variable declarations the same way as tables.Views support only inner joins and field-level aggregation.