cancel
Showing results for 
Search instead for 
Did you mean: 

Color Coding

Former Member
0 Kudos
89

Hi All,

I have a report contains ,some sales fields. In that I have a parameter called highlighting the values are no color, segment wise, metric wise.

Now i need to apply color codes based on value selected in highlighting parameter.

1) If user selects segment wise in highlighting parameter then i need to highlight entire detail section except sales 1, sales 2 fields and no color selected no coloring required.

2) If user selects no color then no highlighting is required.

3) If user selects metric wise and if sales 1 > sales 2 then i need to highlight only sales 2 field and no color selected no coloring required for that field.

And if no value selected in highlighting parameter defaultly no color should be applied

Please suggest

Accepted Solutions (0)

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Vissu,

1) Right-click the Sales 1 field > Format Field > Font tab > click the formula button  beside Color and use this code:

if {?Parameter} = "Metric Wise" then

(

    if currentfieldvalue > {Sales 2} then

          crBlue

    else

          crNoColor

)

else if {?Parameter} in ["Segment Wise", "No Color"] then

     crNoColor

    

2) Go to the Sales2 field and use this code:

if {?Parameter} in ["Segment Wise", "No Color"] then

     crNoColor

3) Then, go to each field in the detail section except Sales 1 and 2 and use this code:

if {?Parameter} = "Segment Wise" then

          crBlue

    else

          crNoColor

These will color the fonts and not the fields/section itself. If you wish to color the section then apply the same formula by going to the Section Expert > Color tab.

-Abhilash

Former Member
0 Kudos

Hi Abhilash,

With below code segment wise is working fine,but when i select metric wise(The condition is if sales 2 > sales 1) the sales 2 field should be highlighted. But now when i select metric wise the sales 1 and sales 2 fields getting black background colors.and if no value selected in parameter list default no field will be applied.

If i select segment wise sales1 and sales 2 should also be highlited.

PFA For my requirement

This formula is applied only  for sales 1 and sales 2

if {?Highliting} = "Metric Wise" then

(

    if {Command.wr_actSale} > {Command.tarSale} then

crNoColor

)

else if {?Highliting} = "Segment Wise" then RGB (100,220,150)

    else

          crNoColor

abhilash_kumar
Active Contributor
0 Kudos

Ok, go to Sales 2 field and apply this formatting formula:

if {?Parameter} = "Metric Wise" then

(

    if currentfieldvalue > {Sales 1} then

          crBlue

    else

          crNoColor

)

else if {?Parameter} = "Segment Wise" then

     crBlue

else

     crNoColor

Then, go the Sales 1 field and use this formula:

if {?Parameter} = "Segment Wise" then

     crBlue

else

     crNoColor

-Abhilash

Former Member
0 Kudos

Hi Abhilash,

It is working Please suggest this also.

if no value selected in parameter i should defaultly display no color.

And is there any formula that i need to highlight total detail section except sales 1 and sales 2(condition) when segment wise selected in parameter and if user selects metric wise then same condition as earlier.Because for formatting it is taking lot of time.

Please suggest

abhilash_kumar
Active Contributor
0 Kudos

Yes, you can. Create a formula to color the details section on the same lines as my previous post.

You would also need to a fomula for the Sales 1 and Sale 2 fields for the reverse conditions.

-Abhilash

Former Member
0 Kudos

Hi Abhilash,

Previous post i didn't get you,can you please give one example.

abhilash_kumar
Active Contributor
0 Kudos

I mean to say that you need to use similar formulas to color the Details Section.

You'll also need separate formulas to color/uncolor Sales 1 and Sales 2 fields. The examples are all above and you can create similar formulas to color the fields/sections depending on the parameter you choose.

-Abhilash

Former Member
0 Kudos

Hi Abhilash one last question,

Suppose in details section->color tab->Background color->

i wrote below formula like this it will highlight all detail section,but i need to highlight except sales 1 and sales 2 if i select segment wise

if {?Parameter} = "Segment Wise" then

     crBlue

else

     crNoColor

Please suggest.

abhilash_kumar
Active Contributor
0 Kudos

Yes, you then need to go to the Background formatting or the Font fomatting and create a formula that will paint either its background or the font in a different color.

In one of my previous replies I suggested a formula for the two Sales fields and you said it worked. So, use the same.

-Abhilash

Former Member
0 Kudos

Hi Abhilash,Thanks you for your support,its working fine.

Please suggest how to give default value for parameter ,i mean if i didn't select any value in Highliting parameter automatically it should be no color applied.

I tried by gave No color in default value of parameter

But i am getting all black background.

PFA

abhilash_kumar
Active Contributor
0 Kudos

And what happens when you 'select' No Color from the list?

Include an else if for No Color in all the formulas and see if it helps.

E.g: ...

     ...

        else if {?parameter} = "No Color"

          then crNoColor

-Abhilash

Former Member
0 Kudos

Hi Abhilash,

When i select no color it is working fine,but i want to apply no color if no value selected in parameter list

Former Member
0 Kudos

You can make the Highlighting Parameter as 'optional' and use the HasValue() logic in all the formulas.

for e.g:

If hasValue({?Highlighting Parameter} then

(

Put original formula code here

)

else crNoColor;

Thanks,

Prathamesh

Former Member
0 Kudos

Hi Prathamesh,

I tried your formula but i am not getting the result.I am getting all black backgrounds.When no value selected it should not apply any color

PFA

if hasvalue({?Highliting})

then

(

if {?Highliting} = "Segment Wise" then

(

    if {Command.wr_actSale} >= {Command.wr_tarSale} and {Command.wr_actSale}<>0 then

RGB(100,220,150)

    else

          crNoColor

)

else if {?Highliting} = "Metric Wise" then

crNoColor

else

     crNoColor

)

Former Member
0 Kudos

I think, you need to put else crNoColor at the end of the code after the closing parenthesis ')'

-Prathamesh