Different Color on a report field........

Discussion forum about all things Report Builder (all versions).
kjellv
Norway
Posts: 84
Joined: 05 Sep 2018, 07:12
Location: sandefjord/Norway

Different Color on a report field........

Post by kjellv » 23 Nov 2015, 08:47

hi

I need to have different background colour on a report field based on the value of the field. If 3 then red, if 2 then green etc. etc. I see there is a function to create a formula, but can any body tell me how to create this formula?

Thanks

MWegner
Germany
Posts: 83
Joined: 11 Apr 2017, 07:39
Location: Germany

Re: Different Color on a report field........

Post by MWegner » 24 Nov 2015, 07:02

Not sure if it will work. Did you try to make 2 fields. One green and one red and only fill one and hide the one that is not filled?

Best regards
Martin

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 2385
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: Different Color on a report field........

Post by Jeff Luther » 24 Nov 2015, 17:11

Martin is on the right track, as this is what I thought as well. ReportBuilder does not have any field attributes functions, so you would need to do a workaround, as Martin suggests. Here is what I would try to finish his thought:

>> Create, for example, 3 fields for your number input item (as your example describes), for an input item = 1, 2, or 3.

>> Each field would be assigned this same input item, each field having a different bkgrnd. color. Only 1 would be visible at a time -- as I describe below -- depending on the input item value.
If input item = 3, have the '3 field' visible; if 2 the '2 field', etc.

>> Now define a formula for each field and use the RB function NumberIFF() to 'filter' it, like the one in the attached Formula Editor dlg. image, which should return a 1 (that is, 'TRUE') if the input = 3. BTW, TD Help has details about this and other RB functions.

>> I did in a quick example and called that formula: INPUT_EQUALS_3(). I added an image of the formula editor for this formula.

>> Now for your '3 field' use the Properties... dlg. box to define a Conditional Display so the '3 field' is visible when the input item = 3. I've attached an image of what I mean.

>> Now do the same thing for other fields when the input = 2, = 1, etc. Each field a different bkgrnd. color. Note that you may want to slightly offset each field, so in RB designer mode you can access (click on) each to access it. You can also move fields during design to access each one.

When the report runs, by definition any of the other non-'3' fields should not be displayed. Kind of a kludgy workaound, I know, but this or something similar should work. (I did not code it into a complete sample.) Let us know your results, especially if you had to code in something differently.
You do not have the required permissions to view the files attached to this post.
Jeff Luther @ PC Design
Palm Springs, California

kjellv
Norway
Posts: 84
Joined: 05 Sep 2018, 07:12
Location: sandefjord/Norway

Re: Different Color on a report field........

Post by kjellv » 25 Nov 2015, 09:29

hi both of you with an answer,

Thanks a lot

It works fine

Again Thanks

:D

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 2385
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: Different Color on a report field........

Post by Jeff Luther » 25 Nov 2015, 16:59

It works fine
Cool! I have a bit of doubt when I suggest something that I did not code completely into a test case, so I am glad to hear it works on the first try. Thanks for letting us know.
Jeff Luther @ PC Design
Palm Springs, California

Return to “General Discussion Report Builder”

Who is online

Users browsing this forum: [Ccbot] and 2 guests