Jump to content
Changes to the Jaspersoft community edition download ×

Removing the blank line - again


juho.mattila

Recommended Posts

Hello

This question has been asked many times over the years according to quick search. I can't make my unwanted blank lines disappear with the answers I found however. So does anyone have new suggestions?

The situation is I have a very basic sql in the main report. Then I'm adding lists with separate datasets for different values that sometimes exist and most often don't. For example the Name is an obligatory field, but Former names is an optional field. The Name works fine, because it's printed every time. Below the Name there is a List with a text "Former names" and the field "Former names". When I run the report, I get the Former names right where they are found, but below every name where no Former names are found there is a gap. I did try :

  • The text field is given a value Former names != null? Former names : null, then "Blank when null" and "Remove line when blank"
  • The field is just the field with "Blank when null" and "Remove line when blank" (I tried also "Print when condition" Former names != null for both this and text field, and same result)
  • The List is with "Remove line when blank"
  • The List is placed inside a Frame, also with "Remove line when blank"
  • They all have Position type "Float" and Stretch type "Relative to Tallest Object"
  • I made a No Data - section and gave When No Data Type = "All Sections No Detail"
  • When Resource Missing Type = null (I don't know if this is relevant)

And the report still gives me blank fields where there are no values for Former names. I need to write appr. 80 fields with similar condition, so help is appreciated.

Cheers,

Juho

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

And more. There was a hint to make a variable (here "Former names") into the main report and get its value from the dataset. Then use Print When Expression print when variable != null.

This is not working either. With this kind of condition, the report removes all the lines. So if I understand the logics right, the returned value from the dataset to the main report is always null..

Link to comment
Share on other sites

Hiding the field will not hide the element that contains it. I find that using groups and bands works the best when the line needs to be hidden along with an empty field. Try creating a group with group selection criteria $F{Name}. Then place Name in the first group band. Add another band and place and Former Names in the second band. Hide the second band if Former Names field is empty.

If you are using excel output, you can check report property "Remove Empty Space Between Rows".

I hope this helps.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...