Jump to content
Changes to the Jaspersoft community edition download ×

Shrink/Remove Text Field When No Data


2004 IR Help

Recommended Posts

By: Rob Stoecklein - rstoeck

Shrink/Remove Text Field When No Data

2005-06-27 15:17

Does anyone know how to shrink (to zero) a text field when it contains no data?

 

For example, consider a simple address label:

Name

Street1

Street2

City-State-Zip

 

When Street2 is blank, then its text field should be completely removed so that the City-State-Zip line immediately follows the Street1 line:

 

Name

Street1

City-State-Zip

 

Any ideas?

 

Thanks,

Rob

 

 

 

 

 

By: Jim Yin - xpdz

RE: Shrink/Remove Text Field When No Data

2005-06-27 19:43

Have you tried the isBlankWhenNull, or think about the printWhenExpression?

 

 

 

 

By: C-Box - c-box

RE: Shrink/Remove Text Field When No Data

2005-06-27 22:40

Well you have to make your fields "Blank when null" first.

Then you have to set the positiontype to "float" and "RemoveLineWhenBlank".... if you do so for all fields you can also reach this one

 

Name

City-State-Zip

 

if there isn't any street. :-)

 

or

Name

Street1

City-State-Zip

 

if there is no Street2 (what you want to reach)

 

Note, that the "RemoveLineWhenBlank" just work, if you don't have any other field "crossing" the Y and Y+Height coordinates of the corresponding element.

 

hth

C-Box

 

 

 

 

By: Rob Stoecklein - rstoeck

RE: Shrink/Remove Text Field When No Data

2005-06-29 06:51

The key was the comment "don't have any other field crossing". This caused the blank line to be removed. However, this then caused the report to loose its formatting!

 

I am putting together a PDF of address labels for the Avery 5160 label page (10 rows of 3 columns each). When the blank line is removed, the report "forgets" that each row (band) is exactly one inch tall, and it puts as many on a page as it can, so that I end of with ~15 rows. How do I make the band adhere to its 1 inch height?

 

This seems like a situation that others must have run into before? Any other ideas?

 

Thanks,

Rob

 

 

 

 

 

By: C-Box - c-box

RE: Shrink/Remove Text Field When No Data

2005-06-29 07:34

Well then you can't use the "RemoveLineWhenBlank" but could fill your fields more clever...

In my case I solved that problem with introducing AdressLine1, AdressLine2, AdressLine3, ..., AdressLine6

 

All these Adresslines are filled BEFORE I call the report by my program (btw. I'm using CustomDataSources not a Connection with query)... where I fill the fields from Bottom up.

 

Just a question of what you want.... You can also put "IfThenElse" clauses into your TextFieldExpression instead of removing the lines that are destroying your base-layout.

 

Or perhaps the easiest way... make a white line at the bottom of your band... and make its positiontype to "fixRelativeToTop"... than all your floating fields move upwards if needed... but your band keeps as high as wanted at designtime

 

hth

C-Box

 

 

 

 

 

 

By: Rob Stoecklein - rstoeck

RE: Shrink/Remove Text Field When No Data

2005-06-29 08:03

Thanks for your quick response, but..

 

If I put a line at the bottom of the band and make its positionType "fixRelativeToTop", then it still does not keep the band a fixed one inch tall, AND it puts the line between the Name and Street1 fields, instead of after the City-State-Zip! Using Horizontal print order.

 

If I switch to Veritcal print order, then the line is put in the correct place, but the band's height still varies depending on how many address lines are displayed.

 

I'm not sure what you mean by "fill the fields from Bottom up".

 

I may try creating a single text field that I assemble by hand using "n" new line characters.

 

-Rob

 

 

 

 

By: Rob Stoecklein - rstoeck

RE: Shrink/Remove Text Field When No Data

2005-06-29 11:24

C-Box:

 

Thanks for your feedback -- I used your "AddressLine1, AddressLine2, etc." technique and got my report working.

 

Thanks again!

Rob

 

 

 

 

 

By: C-Box - c-box

RE: Shrink/Remove Text Field When No Data

2005-06-29 12:55

Fine.... I didn't try the suggestion with the "dummy-line" .. I just guessed that it could work.... unfortunately not, now I also know that! Thanks also for trying it for me! :-)

 

have a nice evening

C-Box

Link to comment
Share on other sites

  • 2 years later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

You have posted to a 4 year old thread that was ported from a former website, so the original posters do not receive your question.

You don't give any detail about your problem. If you have the same problem as the one descriebed in the original post, why is that the various solutions provided in that long thread do not work for you? How do you expect people to give you better solutions when they know nothing about your problem?

 

It would be better if you would create a new thread, but if you do that, please provided enough details about the problem so that you get useful feedback.

 

Thank you,

Teodor

 

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...