Wednesday, June 29, 2016

Print blank when the value is zero in RTC Reports

Sometimes when we are printing decimals/integer fields in the RTC report we don’t want to display zero if the value of the expression is zero, but rather display it as blank,  most of the standard Navision Reports has this logic built in.

For example check this below order confirmation report, the second line unit price is set to zero on the order and it did not print zero but rather printed as blank


image

How did they do this ?

On the RTC Report they created a new function called BlankZero and the function looks like this

Public Function BlankZero(ByVal Value As Decimal)
     if Value = 0 then
         Return ""
     end if
     Return Value
End Function

The function takes a decimal and if the value is zero it returns blank text string.

So for the above example to display unit price it uses the following expression

=Code.BlankZero(Fields!UnitPriceToPrint.Value)
<

If you need to display blank please use the above function in your textbox expression

Please leave your comments, feedback or any suggestions you have for me to improve my blog and also if you have any questions, feel free to post.

Share:

0 comments: