- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Multiple column color formatting
I have multiple columns both numerical and characters. I want to color format for all numeric columns.
My first attempt was using if function
Local ({dt},
dt = Data Table ("Cpk report overall");
dt << Begin Data Update;
For Each Row(
If(
:"Row 1"n >= 1.33, :"Row 1"n << Color cells ("Green", Row()),
(:"Row 1"n < 1.33) & (:"Row 1"n >= 1.06), :"Row 1"n << Color cells ("Yellow", Row()),
:"Row 1"n < 1.06, :"Row 1"n << Color cells ("Red", Row())
)
);
dt << End Data Update;
);
Please ignore my column name as it is the product of transposing a column..
But this method will only apply for 1 of the many columns I have and will have which will not be consistent. Is there a way to make this work for all column without having to specify column names?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Multiple column color formatting
You will want to loop over the columns
Names Default To Here(1);
dt = Data Table("Cpk report overall");
collist = dt << Get Column Names("Numeric", "Continuous");
dt << Begin Data Update;
For Each({colname}, collist,
For Each Row(
If(
:"Row 1"n >= 1.33, :"Row 1"n << Color cells("Green", Row()),
(:"Row 1"n < 1.33) & (:"Row 1"n >= 1.06), :"Row 1"n << Color cells("Yellow", Row()),
:"Row 1"n < 1.06, :"Row 1"n << Color cells("Red", Row())
)
);
);
dt << End Data Update;
but in this case I would consider trying Color Gradient column property instead of coloring cells using << Color Cells
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Multiple column color formatting
You will want to loop over the columns
Names Default To Here(1);
dt = Data Table("Cpk report overall");
collist = dt << Get Column Names("Numeric", "Continuous");
dt << Begin Data Update;
For Each({colname}, collist,
For Each Row(
If(
:"Row 1"n >= 1.33, :"Row 1"n << Color cells("Green", Row()),
(:"Row 1"n < 1.33) & (:"Row 1"n >= 1.06), :"Row 1"n << Color cells("Yellow", Row()),
:"Row 1"n < 1.06, :"Row 1"n << Color cells("Red", Row())
)
);
);
dt << End Data Update;
but in this case I would consider trying Color Gradient column property instead of coloring cells using << Color Cells
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Multiple column color formatting
Thank you!
I overlooked such a convenient "Color Gradient" and "Standardized Attributes"!