Dynamics NAV Reports (RDLC): SetData, GetData And Line Numbers

11 Oct

In Dynamics NAV reports we use SetData and GetData functions to retrieve data certain data in page headers and footers due to different scopes. In this blog post I’m not going to explain why and how but I’m going to give links to some good posts that does it at the bottom this post. Instead I’m going to give you a tip on how to make the process of adding/finding which data that has a certain index in the SetData function call by using line numbers.

In this example I’m using the report 206 “Sales Invoice” from Dynamics NAV 2015. Here you can see a typical GetData function call. Usually when you see this you wonder what the heck GetData(25,1) is and you start to curse Microsoft that they didn’t use place holder labels to make it easier for us (more about that later..).


So what are our options to find out which value 25 is? Well, one is to preview the report and hope that the example invoice contains a value in that field. The other options is to find the SetData function and start counting the rows until you hit index 29. This is how option two would look like. First we find the SetData function in report 206 (Dynamics NAV 2015) by using Document Outline in Visual Studio (Document Outline doesn’t exist in Report Builder). The SetData function call is located in the visibility expression.

As you can see you have to calculate each row until you have reached number 29. BUT! If you are using Visual Studio you can add line numbers to this view which will make it much easier. Unfortunately this is another function that doesn’t exist in Report Builder.
SetData With Line Numbers

So how to get these line numbers then? Well, start by opening the Visual Studio options window (Tools/Options).
Visual Studio Tools Options

Then choose Text Editor/All Languages/General and then tick “Line Numbers” and now you have line numbers in your expression window. This tip originates from one of Claus Lundstrøm report classes.
Visual Studio Options

Want to know more about GetData and SetData in Dynamics NAV reports? Here below are some good links that explains the concept behind it but beware, the placement of the SetData function call could be different depending of which version of Dynamics NAV you are running.

How Do I: Use SetData and GetData in Microsoft Dynamics NAV 2013 R2 [Movie]

Saurav Dhyani – RTC Report Development 3 (Dynamics NAV 2009)

1 Comment

Posted by on 2015-10-11 in Okategoriserade


Tags: , , , , ,

One response to “Dynamics NAV Reports (RDLC): SetData, GetData And Line Numbers

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

The BC Docs Librarian

Tips and news for AL programmers

Stefan Maroń

Dynamics 365 Business Central

James Pearson

Thoughts about Dynamics 365 Business Central, Git, Azure DevOps, PowerShell, Automated Testing, Visual Studio Code...and maybe some other stuff

Roberto Stefanetti BLOG

MVP & MCT Microsoft Dynamics 365 Business Central, Powershell, Azure, SQL Server


DevOps starts with culture!

Comments for DevOps ABCs Blog

Reflections from the ERP field

DevOps ABCs Blog

Reflections from the ERP field

Dynamics 365 Business Central for Partners

Reflections from the ERP field

Freddys blog

Learn something new... - then Teach someone!

Stefano Demiliani Technical Blog

Reflections from the ERP field

David Worthington's NAV Performance Blog

Micosoft Dynamics NAV Performance Testing & Optimization

Freddys Blog

Reflections from the ERP field

Marije Brummel Blog | Business Central, Azure and more...

Design Patterns, Performance, Clean Code

Ideas in the cloud

Goprowe AB

Reflections from the ERP field


Reflections from the ERP field

The NAV Viking´s Blog

- Sharing my experience in the Dynamics NAV world

Comments for

Reflections from the ERP field

Nav Can Be Fun

Its Really Fun to Work with Microsoft Dynamics Nav / D365 Business Central

%d bloggers like this: