logo
small logo
  • Producto
  • Comprar
  • Ayuda
  • About
  • Consola de usarios Ayuda
    • en
    • de
    • JP
    • ZH
  • Página principal
  • /
  • Blogs
  • /
  • How to hide columns in a list if there is no data
  • Informes y documentos PDF en Blazor

    5 de abril de 2021

    Microsoft ha lanzado recientemente una plataforma web llamada Blazor. Este marco permite crear una interfaz

    read more
  • Toilet paper printing

    30 de marzo de 2020

    Gentlemen jokes aside! Today we are talking about toilet paper. This essential hygiene product was

    read more
  • Paquetes FastReport .NET y .NET 5.0

    17 de diciembre de 2020

    UPD: Se aplica a las versiones de FastReport. NET anteriores a 2022.2. Los paquetes de

    read more
  • Cómo actualizar el informe web FastReport.Core

    21 de septiembre de 2020

    A veces es necesario actualizar el informe, por ejemplo, si ingresa un nuevo valor de

    read more
  • El evento de ExportParameters en WebReport.Report

    5 de octubre de 2020

    En FastReport 2020.1 hemos añadido la posibilidad de cambiar los parámetros de exportación. Para hacer

    read more

How to hide columns in a list if there is no data

7 de abril de 2020

When making the report, we want it to be "friendly" to the consumers as much as possible. Too much data and design elements processing makes people's understanding of information more unfavourable. As a result, many people want to delete spaces in a table without data. FastReport.Net report generator allows you to perform this function. As you understand, it is necessary not only to hide the column, but also a title for it. If hiding a column is a matter of a couple of clicks with a mouse, then hiding the title task is not trivial.

Suppose we have a table from which we want to display the data in a report. However, some data may be missing or set to zero. In this case, we can use the “Conditional Selection” tool to hide zero-data cells. Select the desired cell and click on the icon on the toolbar:

 

When you add conditions, by default there will be a check for zero. That is what we need. We only select display options. In our case, we remove the flag visible:

 

Therefore, these non-ingenious operations, we have realized a hidden zero-data cells. But that doesn't solve all the problems. Our task is to hide the title of the entire column if no value is greater than zero. The gap in this column will check the output of each page.

To check that there is no data on the page in a given column, we'll use the “result”.

This result is summed up by a given column and summarizes all the values in it. If the total is zero, then there is not a single value in the column more than zero, and you need to hide the column's header.

So. Let's add the result:

 

The result put in the band "Page Footer":

The result can then be hidden using the “visible” property.

Now let's set the logic to hide the headline of the last column. Instead of the RUB text, we introduce the expression:

[IIf([Total]!=0,Text14.Text = "RUB",Text14.Text = "")]

However, that is not all. Since the result is formed after the title and data are displayed on the page, at the time of execution of expression that we have introduced above, total value is not relevant. Therefore, we need to use the deferred expression calculation option in the column header and double pass on the report.

Choose a text box with the RUB column header. In the properties of the text field we find ProcessAt and change to PageFinished:

 

After this we need to open report properties and install “Doublepass” option:

 

This option allows you to build a report twice. In the first construction will be calculated all the results, and in the second one these results can be used in the headlines. All this is necessary, because the report is built elementally consistently. That is, when building the next element, you will not be able to change the previous one. Therefore, you need a re-build that takes into account the results of the next elements.

Let's see how our report works in terms of when all the data in the RUB column is 0:

 

On some pages the data can appear so the column will appear as well:

 

This way we can dynamically display or hide the columns according to the data in them.

about product comprar
avatar
Dmitriy Fedyashov
Technical Writer
Fast Reports Team: Dmitriy Fedyashov - Technical Writer at Fast Reports
.NET FastReport

Add comment
logo
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314
  • Comprar
  • Descargar
  • Documentación
  • Opiniones de usuarios
  • Cómo desinstalar nuestros productos
  • FAQ
  • Toturial en vídeo
  • Foro
  • Support SLA
  • Documentación técnica
  • Nuestras noticias
  • Quiénes somos
  • Socios
  • Partner program
  • Contactos

© 1998-2023 by Fast Reports Inc.

  • Privacidad
  • Cookies Policy

Trustpilot
By clicking “Accept all, you agree Fast Reports can store cookies on your device and disclose information in accordance with our Cookie Policy.