X
01Jul

How to write custom code in NAV 2013 R2 Report layout design?

You may want to add custom code to the RDLC report to do more actions than what's already provided with the report functions. So it gives you a base for extending your report functionalities which can’t programmed in NAV report design environment. You may want to add custom code to implement simple string manipulation task or sophisticated data access manipulation. So you can add custom functions to RDLC report and add references to functions in report controls. When the report is compiled, the control reference function are executed automatically. Additional assemblies may be referenced using the Report Properties dialog box or the Code Modules element in the report definition. The Report Properties dialog box can also be used to define custom functions. To define custom functions in the report definition, use the Code element.

 

How to add code to a report?

1.      From Report Layout designer in Visual Studio 2012, click Report Properties.

2.      On the Code tab, in Custom code, type the code.

What's the code that I can add?

In the Custom Code section, it won’t support the NAV programing language C/AL. Here you can do the coding in VB. And you can add class members only (properties, methods, fields) but you can't add classes because these members are encapsulated in a class at runtime, this class called Code class.

For example, if you want to convert a string in to upper case letters, then you can write coding as per below screen shot.

 

Custom Code

You can use this code as expression inside a textBox or a table column as following:

=Code.ConvertToUpperCase(Code.getLowerCaseData)

The method toUpper which converts the string field value to an upper case string value.

 

I hope this would help you to make use of Custom Code section in RDLC report design. If some part of the programming is not executable in NAV report design environment, then we can utilize this Custom Code section.

If you wish to discuss further on this topic, please feel free to drop me an email to jithin.mathew@ecanarys.com

Related

New and Important things to know for better RDLC report design in NAV 2013 R2.

We are all learning new things about RDLC report design and we know that still there are lot of thin...

Read More >

Design Microsoft Dynamics Navision 2013R2 RDLC Report Part-2

 In this post we will move to next step, and there we will go through two more data item groupi...

Read More >

Design Microsoft Dynamics Navision 2013R2 RDLC Report

What is RDLC Report?The Report Definition Language (RDL) Data is a report component that is used by ...

Read More >

Share

Comments

Hi JithinI fell over the link belowhttps://www.ecanarys.com/Blogs/ArticleID/150/How-to-write-custom-code-in-NAV-2013-R2-Report-layout-designwhere you write, that if any questions, feel free to ask on email. I hereby do so I need to know the Current PageNo in the report section (not the Page Footer). I have tried to make this the following way.Report CodeShared PageNo_ as IntegerPublic Function SetPageNo(Value as integer) PageNo_ = ValueEnd FunctionPublic Function GetPageNo() As integer Return PageNo_ End FunctionIn the Page Footer section in a textbox I write – in the Hidden Expression=Code.SetPageNo(Globals!PageNumber)In the Report Section I call the following code =Code.GetPageNo + 1 (+ 1 because I hit the Report Section Before the Footer Section)But it returns ’0’ for every page. Can you very easily tell if it is wrong what I’m trying
11/21/2019 7:56:38 PM | Reply

Post a Comment

  • Recent
  • Popular
  • Tag
Monthly Archive
Subscribe
Name

Text/HTML
Text/HTML
Contact Us
  • *
  • *