cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Azim
Level II

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?  

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

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

jthi_0-1729156685933.png

 

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

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

jthi_0-1729156685933.png

 

-Jarmo
Azim
Level II

Re: Multiple column color formatting

Thank you!

 

I overlooked such a convenient "Color Gradient" and "Standardized Attributes"!

Recommended Articles