Jump to content
We've recently updated our Privacy Statement, available here ×

generic conditional formatting


amongalen

Recommended Posts

Lets assume this situation:

On my report I have 40 different text fields (some display Fields from query, some are Variables). Those are some prices. Here are some requirements:
If given prices is negative I'd like to color it red.
For prices I don't really want them to wrap when overflow.  Instead, I'd prefer the font size to decrease so the whole number fits in a single line. For simplicity lets say that I change only between 3 different font sizes.

Those two requirements result in 6 different cases.

 

What is the best solution in this situation?
I know there are conditional styles but from my understanding they can't be really generic, I'd have to write a conditional style for every field I have, resulting in 40 styles with 6 variants each.
Other option would be to use markups inside of the text field's expression. However, given how ifs are handles in field expression (you kind of have to use ternary operators), it will get overcomplicated with 6 different cases - even worse if the displayed value itself is something more complicated. What is more, if you use markups you will lose number formatting set on a field (it turns BigDecimals into String) so you would have to add it to the inside of the text field expression as well.
Last method I can think of is to multiple version of a given field, one for each formatting option, place them all on each other and display only one. This would result in 240 text fields instead of 40.

Both first and third options are kind of viable but at the same time would require a lot of work and will be hard to maintain later on.


What is the best approach to this problem? I've seen multiple question on this topic but not a single one with any good solution.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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