cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-806424%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%E5%A4%9A%E5%88%97%E9%A1%8F%E8%89%B2%E6%A0%BC%E5%BC%8F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-806424%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CP%3E%E6%88%91%E6%9C%89%E5%A4%9A%E5%80%8B%E6%95%B8%E5%AD%97%E5%88%97%E5%92%8C%E5%AD%97%E5%85%83%E5%88%97%E3%80%82%E6%88%91%E6%83%B3%E7%82%BA%E6%89%80%E6%9C%89%E6%95%B8%E5%AD%97%E5%88%97%E8%A8%AD%E5%AE%9A%E9%A1%8F%E8%89%B2%E6%A0%BC%E5%BC%8F%E3%80%82%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3E%E6%88%91%E7%9A%84%E7%AC%AC%E4%B8%80%E6%AC%A1%E5%98%97%E8%A9%A6%E6%98%AF%E4%BD%BF%E7%94%A8%20if%20%E5%87%BD%E6%95%B8%3C%2FP%3E%3CPRE%3ELocal%20(%7Bdt%7D%2C%3CBR%20%2F%3Edt%20%3D%20Data%20Table%20(%22Cpk%20report%20overall%22)%3B%3CBR%20%2F%3Edt%20%26lt%3B%26lt%3B%20Begin%20Data%20Update%3B%3CBR%20%2F%3EFor%20Each%20Row(%3CBR%20%2F%3EIf(%3CBR%20%2F%3E%3A%22Row%201%22n%20%26gt%3B%3D%201.33%2C%20%3A%22Row%201%22n%20%26lt%3B%26lt%3B%20Color%20cells%20(%22Green%22%2C%20Row())%2C%3CBR%20%2F%3E(%3A%22Row%201%22n%20%26lt%3B%201.33)%20%26amp%3B%20(%3A%22Row%201%22n%20%26gt%3B%3D%201.06)%2C%20%3A%22Row%201%22n%20%26lt%3B%26lt%3B%20Color%20cells%20(%22Yellow%22%2C%20Row())%2C%3CBR%20%2F%3E%3A%22Row%201%22n%20%26lt%3B%201.06%2C%20%3A%22Row%201%22n%20%26lt%3B%26lt%3B%20Color%20cells%20(%22Red%22%2C%20Row())%20%3CBR%20%2F%3E)%3CBR%20%2F%3E)%3B%3CBR%20%2F%3Edt%20%26lt%3B%26lt%3B%20End%20Data%20Update%3B%3CBR%20%2F%3E)%3B%3C%2FPRE%3E%3CP%3E%E8%AB%8B%E5%BF%BD%E7%95%A5%E6%88%91%E7%9A%84%E5%88%97%E5%90%8D%EF%BC%8C%E5%9B%A0%E7%82%BA%E5%AE%83%E6%98%AF%E8%BD%89%E7%BD%AE%E5%88%97%E7%9A%84%E7%94%A2%E7%89%A9%E3%80%82%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3E%E4%BD%86%E6%AD%A4%E6%96%B9%E6%B3%95%E5%83%85%E9%81%A9%E7%94%A8%E6%96%BC%E6%88%91%E6%93%81%E6%9C%89%E5%92%8C%E5%B0%87%E6%93%81%E6%9C%89%E7%9A%84%E7%9C%BE%E5%A4%9A%E5%88%97%E4%B8%AD%E7%9A%84%E4%B8%80%E5%88%97%EF%BC%8C%E9%80%99%E5%B0%87%E4%B8%8D%E4%B8%80%E8%87%B4%E3%80%82%E6%9C%89%E6%B2%92%E6%9C%89%E4%B8%80%E7%A8%AE%E6%96%B9%E6%B3%95%E5%8F%AF%E4%BB%A5%E4%BD%BF%E6%AD%A4%E5%8A%9F%E8%83%BD%E9%81%A9%E7%94%A8%E6%96%BC%E6%89%80%E6%9C%89%E5%88%97%E8%80%8C%E7%84%A1%E9%9C%80%E6%8C%87%E5%AE%9A%E5%88%97%E5%90%8D%EF%BC%9F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-806424%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CLINGO-LABEL%3E%E8%87%AA%E5%8B%95%E5%8C%96%E5%92%8C%E8%85%B3%E6%9C%AC%E7%B7%A8%E5%AF%AB%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%E6%95%B8%E6%93%9A%E6%8E%A2%E7%B4%A2%E5%92%8C%E8%A6%96%E8%A6%BA%E5%8C%96%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-806453%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E8%A6%86%EF%BC%9A%E5%A4%9A%E5%88%97%E9%A1%8F%E8%89%B2%E6%A0%BC%E5%BC%8F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-806453%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%82%A8%E5%B0%87%E9%9C%80%E8%A6%81%E5%BE%AA%E7%92%B0%E9%81%8D%E6%AD%B7%E5%88%97%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0A%0Adt%20%3D%20Data%20Table(%22Cpk%20report%20overall%22)%3B%0Acollist%20%3D%20dt%20%26lt%3B%26lt%3B%20Get%20Column%20Names(%22Numeric%22%2C%20%22Continuous%22)%3B%0Adt%20%26lt%3B%26lt%3B%20Begin%20Data%20Update%3B%0A%0AFor%20Each(%7Bcolname%7D%2C%20collist%2C%0A%09For%20Each%20Row(%0A%09%09If(%0A%09%09%09%3A%22Row%201%22n%20%26gt%3B%3D%201.33%2C%20%3A%22Row%201%22n%20%26lt%3B%26lt%3B%20Color%20cells(%22Green%22%2C%20Row())%2C%0A%09%09%09(%3A%22Row%201%22n%20%26lt%3B%201.33)%20%26amp%3B%20(%3A%22Row%201%22n%20%26gt%3B%3D%201.06)%2C%20%3A%22Row%201%22n%20%26lt%3B%26lt%3B%20Color%20cells(%22Yellow%22%2C%20Row())%2C%0A%09%09%09%3A%22Row%201%22n%20%26lt%3B%201.06%2C%20%3A%22Row%201%22n%20%26lt%3B%26lt%3B%20Color%20cells(%22Red%22%2C%20Row())%0A%09%09)%0A%09)%3B%0A)%3B%0A%0Adt%20%26lt%3B%26lt%3B%20End%20Data%20Update%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%E4%BD%86%E5%9C%A8%E9%80%99%E7%A8%AE%E6%83%85%E6%B3%81%E4%B8%8B%EF%BC%8C%E6%88%91%E6%9C%83%E8%80%83%E6%85%AE%E5%98%97%E8%A9%A6%E9%A1%8F%E8%89%B2%E6%BC%B8%E8%AE%8A%E5%88%97%E5%B1%AC%E6%80%A7%EF%BC%8C%E8%80%8C%E4%B8%8D%E6%98%AF%E4%BD%BF%E7%94%A8%20%26lt%3B%26lt%3B%20Color%20Cells%20%E7%82%BA%E5%96%AE%E5%85%83%E6%A0%BC%E8%91%97%E8%89%B2%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jthi_0-1729156685933.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jthi_0-1729156685933.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jthi_0-1729156685933.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F69226iB71D7B170E9C8035%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jthi_0-1729156685933.png%22%20alt%3D%22jthi_0-1729156685933.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%20%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-806706%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E8%A6%86%EF%BC%9A%E5%A4%9A%E5%88%97%E9%A1%8F%E8%89%B2%E6%A0%BC%E5%BC%8F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-806706%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E8%AC%9D%E8%AC%9D%E4%BD%A0%EF%BC%81%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3E%E6%88%91%E7%AB%9F%E7%84%B6%E5%BF%BD%E7%95%A5%E4%BA%86%E9%80%99%E9%BA%BC%E6%96%B9%E4%BE%BF%E7%9A%84%E3%80%8C%E9%A1%8F%E8%89%B2%E6%BC%B8%E5%B1%A4%E3%80%8D%E5%92%8C%E3%80%8C%E6%A8%99%E6%BA%96%E5%8C%96%E5%B1%AC%E6%80%A7%E3%80%8D%EF%BC%81%3C%2FP%3E%3C%2FLINGO-BODY%3E
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