Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8644913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:24:58+00:00 2026-06-12T12:24:58+00:00

I would like to achieve a simplified result similar to the Color Scale function

  • 0

I would like to achieve a simplified result similar to the “Color Scale” function in Excel i.e. gradient colouring based on the lowest value (red) to highest value (green), except in my cross tab using Crystal Reports 2008. My cross tab looks a little like this:

 HOURS    L1   L2  L3   L4  Total
 1 hours | 5 | 0 | 1 | 16 | 22 |
 2 hours | 0 | 1 | 0 | 10 | 11 |
 3 hours | 8 | 2 | 6 | 12 | 28 |
 TOTAL   |13 | 3 | 7 | 38 | 61 |

The principle of my function is find the maximum value in the cross table then use 20%, 40%, 60%, 80% values to colour the background. Function is as follows (in the format > background section):

    if currentfieldvalue < ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.2) then color(255,0,0)
else if (currentfieldvalue >= ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.2) and 
        currentfieldvalue < ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.4)) then color(255,192,0)
else if (currentfieldvalue >= ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.4) and 
        currentfieldvalue < ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.6)) then color(255,255,0)
else if (currentfieldvalue >= ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.6) and 
        currentfieldvalue < ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.8)) then color(146,208,80)
else if (currentfieldvalue >= ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.8)) then color(0,176,80)

It’s not elegant, nor does it work properly, any assistance/suggestions would be much appreciated. I wasn’t expecting it to be so complicated as originally I was working with the below assuming it would work, except it tells me that “CurrentFieldValue” is not a field.

if CurrentFieldValue < ((Maximum (CurrentFieldValue))*0.2) then color(255,0,0)
else if ... etc.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:24:59+00:00Added an answer on June 12, 2026 at 12:24 pm

    With some help from this post: For each crosstab column, highlight maximum value, I managed to get the result I wanted. Hope this helpful to someone else out there. Cheers.

    local Numbervar max:=0;
    local Numbervar col;
    local Numbervar row;
    
    for col := 0 to GetNumColumns-2 do 
    (
        for row := 0 to GetNumRows-2 do 
        (
            local numbervar value := GridValueAt (row, col, CurrentSummaryIndex);
            if value > max 
                then max := value;
        );
    );
    
    ToText(max,"#");
    
    // Reference Red 248,105,107
    // ReferenceGreen 99,190,132
    
    local Numbervar cRed;
    local Numbervar cGreen;
    local Numbervar cBlue;
    
    cRed := Floor(99 + 149 * (1-(GridValueAt (CurrentRowIndex, CurrentColumnIndex, 0)/max)));
    
    cGreen := Floor(105 + 85 * (if (((GridValueAt (CurrentRowIndex, CurrentColumnIndex, 0)/max))*10) > 1 then 1));
    
    cBlue := Floor(107 + 25 * ((GridValueAt (CurrentRowIndex, CurrentColumnIndex, 0)/max)));
    
    color(cRed, cGreen, cBlue)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to achieve something very similar to Microsoft Access query designer -
I would like to achieve something similar to how scala defines Map as both
I would like to achieve this functionality. <p:column> <p:commandLink value=prihlasit oncomplete=dlg.show(); action=#{signForProjectBean.setProjectForDetail(item)} /> </p:column>
I would like to achieve something similar to the following in Guice: public MyClass
I would like to achieve a similar look and feel as in MS OFfice.
I would like to achieve the following: I want a free Application Lifecycle Management
I would like to achieve the following: On homepage load, display modal box Within
I would like to achieve the following, I need to generate report for multiple
What I would like to achieve here is a user selects an operator, e.g.
Here is what I would like to achieve: I have a web service A

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.