Options

SetFields: an alternative to Setdata - Getdata?

gerdhuebnergerdhuebner Member Posts: 155
edited 2015-12-21 in NAV Tips & Tricks
There may be a much easier and more intuitive method for generating dynamic headers in RDLC reports in NAV 2013 R2 and higher.
I call it the SetFields method and it works in short like this:

1.) For each NAV field or array to be shown in the page header, I create a public shared variable or array within the custom code section of the report.
2.) Instead of calling the SetData function with a concatenated string as parameter, I call the SetFields function with the whole Fields collection as one parameter.
3.) Instead of calling the GetData function in the textboxes on the header, I refer to these public shared variables or arrays, directly. So the expression of the textboxes is readable, for example, =Code.custAddr(1) instead of =GetData(47,5)
4.) If another field has to be added to the header, I simply add another public shared variable and write another line of code to the SetFields function.

Please take a look on the method, here https://massivedynamicsblog.wordpress.com/2015/11/15/getting-rid-of-setdata-and-getdata-in-rdlc-reports-of-ms-dynamics-nav/ (There is also a sample report, you can download) and tell me, what method you like more. May be there is some other reason, why the SetFields method should not be used. If you find some issues, please tell me, too.

Answers

  • Options
    Thanks for sharing! I will definitely test this:)
    What I currently use to simplify setdata getdata functionality to work with dynamic headers is function ReportItems
Sign In or Register to comment.