13 Nov’17

Dynamics NAVTechnique to hide whitespace if the textbox value is not present in a report in Dynamics NAV


In this article I will be giving the procedure required to hide whitespace if the textbox value is empty and hence not displayed in a report of Dynamics NAV.


Microsoft Dynamics NAV


1. I have created a simple report with four field values from Customer table for demonstration.

2. I want to display these four fields in a report. So I have created a textbox in the report with these four field values. Instead of creating four different textboxes, I prefer only adding one textbox and giving a line break between each field.

3. The value of the expression of the textbox is as follows:

=First(Fields!Name_Customer.Value, "DataSet_Result") & "<br/>" & First(Fields!Address_Customer.Value, "DataSet_Result") & IIf(First(Fields!Address2_Customer.Value, "DataSet_Result")<>"","<br/>","") & First(Fields!Address2_Customer.Value, "DataSet_Result") & "<br/>" & First(Fields!City_Customer.Value, "DataSet_Result")

 Expression A

I’ll explain the Expression A below in detail: 

a. “<br/>” is added to insert a line break between each field value. But this expression is used in HTML. So we need to set the textbox to Interpret HTML tags as styles. Hence, you need to double click on your textbox expression. On double clicking the expression, a window opens up which is the Placeholder Properties window. In the Placeholder properties window, set the ‘Markup type’ to ‘HTML-Interpret HTML tags as styles’.

b. Now, there is a possibility that ‘Address 2’ field value of the Customer can be empty at times. So a whitespace will be displayed in the report. So to remove the whitespace, I have put the below expression in Point no.: 3

IIf(First(Fields!Address2_Customer.Value, "DataSet_Result")<>"","<br/>","")

 This means that if the Address 2 of the Customer has a value there will be a line break and if no value is present nothing will be displayed and there will be no line break too. Hence whitespace will not be visible in the report. This can be done for any field value which has a possibility to be empty.

The output of the report looks like below:

I executed the report for Customer No: 01445544-Progressive Home Furnishings

If the Address 2 field value is empty: 

Report preview is as below: 

If the Address 2 has a value present: Report preview is as below: This is the simplest way to hide whitespace in a report if the textbox value is empty.

Written by

Team Member


Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Commands to Import .bacpac file to D3FOE SQL Server

    14 May’ 2018

    Introduction: This blog article will explain how to import a .bacpac file to Microsoft SQL Server which is created from ...

    Read more
  • [Solved] – Backspace not working in HTML Web Resources

    11 May’ 2018

    Issue: When we use a HTML web resource in Dynamics 365 CRM forms or even as a separate navigation, we sometimes face is...

    Read more
  • Dynamics 365 Tip: Sending Emails using Unified Interface

    10 May’ 2018

    Introduction: The unified client which was released D365 V9 had a very refreshing UI and lots of features. One of the b...

    Read more
  • Filtering Records on BPF unlike on Form – D365

    10 May’ 2018

    Introduction: Working with D365 is best when you’re trying to use as much OOB stuff as possible. Simplest configurati...

    Read more
  • Filter records in gallery control based on value selected in other gallery control in PowerApps.

    10 May’ 2018

    Introduction: This blog explains how to Filter records in gallery control based on value selected in other gallery cont...

    Read more