cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

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