In RDLC Reports in NAV there are a few different ways to hide data. In this blog I’ll give a quick overview of the three ways that I normally use, and in what situation I use them. I’ll be using a Textbox in my examples, but other Report Items can also be hidden this way.
I use the Hidden property when I want to not display the value of a Textbox in a Tablix row. Or when it doesn’t matter if the Textbox showing or not, makes the rest of the fields slightly change position.
Example: When the total Discount Amount of a Sales Invoice equals 0, I want to hide the Discount part of the Page Footer section, because I don’t want to show the Customer that they didn’t get a discount. So I’d set the Hidden property of the two fields (both Caption as well as Value) to something like ‘=iif(Fields!TotalDiscount.Value = 0,true,false)’.
Expression property of a Textbox.
I use the Expression property of a Textbox to hide the value of that Textbox when the position of the other fields in (usually) the Page Header or Page Footer needs to be the same, whether the value of the Textbox is shown or not.
Example: When the sixth line of a Customer Address on a Sales Invoice is blank, on my Sales Invoices are sent in envelopes with a window to show the Customer Address, I don’t want a blank line in that address cause the information underneath that Address to move upwards, displaying maybe part of the Line Header fields, or any other information. So I could set the Expression property of the Textbox to something like ‘=iif(Code.GetData(10,1) <> “”,Code.GetData(10,1),””)’, where Code.GetData(10,1) is the sixth Customer Address line.
I use the RowVisibility property when in certain situations an entire row in a Tablix needs to be shown or hidden.
Example: On a Purchase Order, you sometimes add some Comments to the Purchase Order Line to explain or specify something to the Vendor. So when a Purchase Order Line has some of those Comments added, you might want to show those right underneath the Purchase Order Line they belong to. But if there are no Comments added, you don’t want anything to show, not even an empty line. So you’d click the ‘Row Visibility…’ after right-clicking the row, check the ‘Show or hide based on an expression’ option, and click the ‘fx’ button to enter the expression, that could be something like ‘=iif(Fields!Comment.Value = “”,true,false)’.