NAV 2013 R2 Report Trick – Split Concatenated String on New Line

Presentation of data is really important for reports since it is an effective way to show users key data they will be interested in.

In this demonstration, we will go over a quick NAV 2013 R2 report trick that will display information in a user-friendly manner. If you are going to have a string that will be concatenated, you have the ability to show each value that will be added to the string on new lines by adding a special character in your string. We will be able to replace the special character in Visual Studio by the new line function.

  1. Define a text variable
    1. Navigate to the report global variables by going to View > C/AL Globals
    2. BinRecord will be a text variable that will hold multiple values for the Bin Code field

     

    1.0

     

     

  2. Add a special character
    1. In this code, Bin Code is added to the BinRecord until the BinCount value is less than 5
    2. Each time Bin Code is added to the BinRecord variable, a “|” will be inserted in between. This allows us to replace the “|” with the new line function.
      2.0
  3. Modify the report
    1. Navigate to the report layout by going to View > Layout
    2. Add the BinRecord variable to a textbox in the report layout
      3.0
    3. Modify the code to replace the “|” with the new line function “VBCRLF”
      1. Before code change:
        4.0
      2. After code change:
        5.0
    4. This code change will replace “|” after each Bin Code value with a new line
  4. Report output
    1. Report preview before code change:
      6.0
    2. Report preview after code change:
      7.0

The appearance of the data after the code change presents the data in a way that will be easy to read and understand. Identifying ways to improve the report layout will help users understand the information that will be portrayed to them and make the report look meaningful.

July 22, 2015