Hiding zero values

Top  Previous  Next

The "Text" object has the "HideZeros" property which can be used to hide zero values. Lets look at an object with the following contents:

 

Total elements: [CountOfElements]

 

If the value of variable CountOfElements is equal to 0, and the property HideZeros is set to true, the object will be printed as follows:

 

Total elements:

 

The "Text" object also has the "HideValue" property which can be used to hide the value of an expression which is equal to the given value. For example, if the property value is "0", then all the zero fields will be hidden. This property can also be used for hiding zero dates. As a rule, it's a date like "1.1.0001" or "1.1.1900". In this case the value of "HideValue" property must be like this:

 

1.1.1900 0:00:00

 

As you can see, apart from the date, you need to indicate time as well. This is necessary because the value of the date in .Net contains time also.

 

Important note: this mechanism depends on the regional settings of your system, which can be set in the control panel. This happens because FastReport compares strings using the "ToString()" method. This method converts an expression value into a string. In relation with this, be careful when building reports which can be launched on a computer with different regional settings.

 

 

Finally, the "NullValue" property of the "Text" object allows to print some text instead of a null value. It is often used to print the dash instead of a null value. Lets look at an object with the following contents:

 

Total elements: [CountOfElements]

 

If the value of variable CountOfElements is null, and the property NullValue is set to --, the object will be printed as follows:

 

Total elements: --