O'Reilly logo

Implementing Microsoft Dynamics NAV 2013 by Cristina Nicolas Lorente, Laura Nicolas Lorente

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Where to use queries

Queries can be used in C/AL code or in Dynamics NAV charts. They can also be published as web services and thus consumed by external applications. In this section, we will see exactly where queries can be used.

C/AL code

Queries can be accessed from C/AL code. It is a good idea to use queries instead of writing C/AL code involving record variables when you want to read records from multiple tables at the same time.

Executing a query from C/AL code is as simple as defining a variable of type Query and typing the following sentences:

MyFirstQuery.OPEN; WHILE MyFirstQuery.READ DO OutputData(MyFirstQuery.Item_No, MyFirstQuery.Month_Posting_Date, MyFirstQuery.Sum_Quantity, MyFirstQuery.Source_No, MyFirstQuery.Description, MyFirstQuery.Name, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required