Ever wondered why there’s no tutorial on how to create a Sales Order report from scratch in the RDLC? The reason is because it takes a LONG TIME! Even for an experienced developer, it takes a long time. As I previously mentioned on my article, Microsoft really needs to address this in future versions.
The reason for SetData and GetData is not because of performance reason as stated in the manual 80146B. For additional information on defining SetData and GetData, please look here.
For multiple pages, the header data is dependant on whether there are lines. If you’re printing multiple form type reports like the sales order and you do not use the SetData and GetData, the header will only link to the lines displayed on the first page of the report. So this means that if your sales order is printed to the 2nd page, the header information will all disappear.
Here’s an example if you create a report without using the SetData and GetData logic:
This is the first page. As you can see, the header displays nice and pretty. I used whiteout to remove some sensitive information in Paint.
Now this is what happens when you print the 2nd page:
No, it’s not an error. You’re seeing it correct. It’s a blank page. I didn’t even have to use Paint to remove any information.
The reason why the 2nd page is blank, again, is because the link was done only on the first page on the header. If the report goes to the 2nd page, the link is essentially gone, therefore, no value is loaded and so nothing is displayed.
So when you create a report that has headers in forms (sales order, quote, etc). You need these:
Shared Offset As Integer
Shared NewPage As Object
Public Function GetGroupPageNumber(NewPage As Boolean, PageNumber As Integer) As Object
If NewPage
Offset = PageNumber – 1
NewPage = False
End If
Return PageNumber – Offset
End Function
Public Function IsNewPage As Boolean
NewPage = True
Return NewPage
End Function
Shared HeaderData As Object
Public Function GetData(Num As Integer) As Object
Return Cstr(Choose(Num, Split(Cstr(HeaderData),Chr(177))))
End Function
Public Function SetData(NewData As Object)
If NewData <> “” Then
HeaderData = NewData
End If
End Function
And you need these controls with the proper code:
We spent hours and hours trying to get our report header to print on multiple pages. Don’t make the same mistakes we did!
EDIT – Thanks to Steven for pointing this out. It turns out that this was mentioned on the 80146B manual on Chapter 3 page 35. Shows you that you shouldn’t go through the 300+ page manual quickly!
Pingback: Navision RDLC reporting – SetData and GetData – Why It Is REQUIRED - Confessions of a Dynamics NAV / Navision Consultant
Dude,
If you had read the manual you would have known this and not lost hours of time…
Which manual did you read? Specifically, which manual and which chapter can I find the information you’re referring to? I’m always glad to read up more information on this RDLC reporting in Navision.
Hi,
The MOC 80146, Report Design in Dynamics NAV 2009. http://www.microsoft.com/learning/en/us/syllabi/80146A.aspx
Honestly, I found it quite interesting. On some topics more info would be helpfull, but it’s a nice MOC to start with.
Kind regards,
Steven
To be more specific, Chapter 3 page 26 & 27: Adding Database Pictures to the Header.
Also mentioned on page 35, and page 55 as part of an exercise.
Gosh.. I see it.. I wonder why I missed it the first time around… Would’ve save a lot of time…
I’ll buy you a beer next time I see you!
I have been working with R2, and I could not find the setdata box, though there is still getdata and setinfo.
Have there been some undocumented changes or are they just doing a really good job of hiding some of the boxes?
There is still one box in the top left, but it does not have setdata.
It’s there hidden somewhere. The function on this particular report is called SetInfo.
If the dataset is empty, can is the data header still show..?
Pingback: Report changes in NAV 7 | Some preparations - Mark Brummel - Author of Microsoft Dynamics NAV 2009 Application Design
You can do it alot easier, try this in the header textboxes:
=Reportitem!
And you’ll be able to set any textbox or field data, from the main report, into the header without this get-, setdata function.
Hi, I am trying to understand how this Get/Set Data works in the Order Confirmation report (205).
It has only one SetData instruction using CustAddr. This is an 8 element Array holding the Customer Address.
The report however is using things like GetData(17,1) etc.
I altered the report to show the contents of CustAddr and it does have much more than 8 parts. How is it getting this extra data?
Incidentally, GetData(17,1) returns the report title which will either be Order Confirmation or Copy.
Thanks.
There is multiple SetData Calls in report 205. If you open up the Report in Visual Studio you can see a small Tablix right above the Lines. Each Column of this Tablix Provides a SetData() Call which fills the corresponding arrays (Getdata(x,1);GetData(x,2);GetData(x,3))
I know this post is obsolet and old but im writing this because i was searching for information about GetData and SetData. I ultimately ended up with removing those 2 because we are opening only 1 confirmation at a time for batch processing.
Hi from 2018 (Using NAV2016 version). I guess Microsoft did not address the issue in future versions. 🙂
Nope. It doesn’t look like Microsoft will invest more into improving RDLC development.
Microsoft is moving away from static type reports and into real time BI type reporting. Which makes sense because the data in the reports is obsolete when you print them.