cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Choose Language Hide Translation Bar
kayne
Level II

Coloring selective cells

Hi there, how do I color the cells red for values that are lower than the limits? Thanks.

dt = New Table( "Marks",

    Add Rows( 2 ),

    New Column( "Name", Character, Nominal, Set Values( {"Peter", "Leslie"} ) ),

    New Column( "Limits",

        Numeric,

        Continuous,

        Format( "Best", 12 ),

        Set Values( [20, 30] )

    ),

    New Column( "Column 1",

        Numeric,

        Continuous,

        Format( "Best", 12 ),

        Set Values( [10, 15] )

    ),

    New Column( "Column 2",

        Numeric,

        Continuous,

        Format( "Best", 12 ),

        Set Values( [30, 40] )

    ),

    New Column( "Column 3",

        Numeric,

        Continuous,

        Format( "Best", 12 ),

        Set Values( [20, 55] )

    ),

    New Column( "Column 4",

        Numeric,

        Continuous,

        Format( "Best", 12 ),

        Set Values( [53, 24] )

    ),

    Set Row States( [0, 1] )

)

fail = dt << Get Rows Where( :Column 1 < :Limits );

:Column 1 << color cells(Red, fail);

10 REPLIES 10
pmroz
Super User

Re: Coloring selective cells

You have to color by column.  This code will do the trick.  The color "73" is a bit lighter than "Yellow"

for (i = 1, i <= ncols(dinout), i++,
	column(dinout, i) << Color Cells( {73, {40}} );
);