logo
small logo
  • Products
  • Buy
  • Support
  • Articles
  • Customer panel Support
    • en
    • ru
    • pt
    • es
    • de
    • pl
    • JP
    • ZH
  • Home
  • /
  • Articles
  • /
  • How to hide columns in a list if there is no data
  • How to use Plugin Manager

    September 3, 2019

    FastReport.Net provides a plugin mechanism for extending the functionality of the report designer. Most of

    read more
  • How to connect to Firebird from FastReport.Net

    November 15, 2019

    In order to connect to Firebird database in FastReport.Net Designer a plug-in connector is provided. It

    read more
  • How to sort the data in the report FastReport.Net

    April 22, 2020

    Sorting data is one of the most important data processing tools. We can say, it

    read more
  • MS Word format vs. Open Document Text. Which is better?

    October 19, 2020

    Speaking of text editors, we immediately present coryphaeus as Microsoft Word, which for many years

    read more
  • How to make a report like Drill-Down

    September 4, 2019

    Reports with grouping are necessary for data analysis. But when there are a lot of

    read more

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

April 7, 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 download buy
avatar
Dmitriy Fedyashov
Head of QA
.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
  • Buy
  • Download
  • Documentation
  • Testimonials
  • How to uninstall
  • Ticket system
  • FAQ
  • Tutorial Video
  • Forum
  • Articles
  • Our News
  • Press about us
  • Resellers
  • Our team
  • Contact us

© 1998-2021 by Fast Reports Inc.

  • Privacy Policy