Thursday, July 29, 2010

NextReports 'Hide when expression' property

NextReports Designer version 3.3 will add a new important feature to its core engine. A new property called 'hide when expression' can be set for every layout cell .

What does this mean?

This property contains an expression. If expression is evaluated to true at runtime, the cell content will be empty in the resulting exported report file. Also, if all cells from a row have 'hide when expression' property set and all those expressions are evaluated as true, the entire row will be hidden.


Lets show an example with default Timesheet report.

You can see detail row D1 with some expressions. $E{WorkHours} expression  represents the work hours from column $C{Hours} and it is defined like this :

All other expressions are similar testing the corresponding activity code.

Because we do not want those expressions to be shown at runtime, we will set 'hide when expression' property for the containing cells. In this case, the expression is one which will always be true :

All cells from D1 row are always hidden, so the entire row will be hidden. That is why there is no need to set other properties for those cells like color, font and so on.

Expressions are used in some functions which can be seen in footer rows. For example, the total work hours is a function created on $E{WorkHours} expression :

 In this way we can have a more detailed report as seen in following results :


Anonymous said...

why hide when expression can't use column values?
i tried with this $C_Column1 > 1


Mihai Dinca-Panaitescu said...

You can use column values, but your expression must be in detail band.