Chapter 12. The Query Object

Microsoft Dynamics NAV 2013 introduces a new application object: the query. Although it is not yet, this new application object is meant to be "The Microsoft Dynamics NAV reading data object" in the future (notice the capital letter in the word "The"), so you better get familiar with it as soon as possible.

In this chapter, we will take an in-depth look at this new application object. We will go through the following topics:

  • What is a query
  • What can be done with a query
  • Query Designer
  • Defining a query
  • Where queries can be used
  • Query performance

What is a query

Query is the name of a new Dynamics NAV application object introduced in Microsoft Dynamics NAV 2013. This application object is only meant to retrieve data from the database. It is a read-only object. It cannot modify, delete, or insert new data into the database.

Queries are the ninth object type in Dynamics NAV, although only seven are available in Dynamics NAV 2013, now that forms and dataports are gone.

There are many things about queries in Dynamics NAV that will make you just love them:

  • They allow us to retrieve data from multiple tables at the same time
  • They allow us to retrieve only specific fields in a table
  • They allow us to group the retrieved data according to certain fields without the need of any explicit key for them
  • They allow us to total the retrieved data using different totaling methods (sum, count, average, min, and max)

If you are a Dynamics NAV programmer and you have worked with the previous versions of Dynamics NAV, you will see the advantages and the possibilities of this new object right away.

The query object makes programming easier and for the lovers of performance, it makes data retrieval a lot faster.

In this chapter, we will show you how to define a query using the query editor and where and how to use queries on your developments. Once we know how to write and execute queries, we will compare them both in time and effort of development and in speed, against the old ways of retrieving the exact same data out of the application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset