cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Dennisbur
Level IV

Color specific column by JSL

Hello
I tried to color in red the value "The First Bin Fail" in column "FIRST_BIN". 

and JSL colored all the table in red

can you explain where I did go wrong in my script?

 

dt << Select where ( :FIRST_BIN == "The first Bin Fail") << Color Cells ("Light Red");

 

Provide a table how I need to color it: 

Dennisbur_0-1677140294466.png

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Victor_G
Super User

Re: Color specific column by JSL

Hi @Dennisbur,

 

I'm not an expert in JSL, but this looks more like setting a column property related to this value, and then apply Color cell by value :

// Change column property: FIRST_BIN

Data Table( "Untitled" ):FIRST_BIN << Set Property(
	"Value Colors",
	{"The first Bin Fail" = -13912408}
);
Wait( 1 );
:FIRST_BIN << Color Cell by Value( 1 );

There might be some improvement and changes (color, datatable name, ...) to do with this code, in order to better handle missing values or other possible values, but it does color in red those cell values : 

Victor_G_0-1677148668326.png

I hope this will help you.

Victor GUILLER
Scientific Expertise Engineer
L'Oréal - Data & Analytics

View solution in original post

jthi
Super User

Re: Color specific column by JSL

Scripting index has quite good examples on how to use << Color cells (it is used to color specific rows in specific column). Below is a slight modification from an example

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
rows_to_color = dt << Get Rows Where(:age == 13);
wait(1);
Column(dt, "age") << Color Cells("Red", rows_to_color);

Using Value Colors column property is also a good option like @Victor_G suggested

-Jarmo

View solution in original post

2 REPLIES 2
Victor_G
Super User

Re: Color specific column by JSL

Hi @Dennisbur,

 

I'm not an expert in JSL, but this looks more like setting a column property related to this value, and then apply Color cell by value :

// Change column property: FIRST_BIN

Data Table( "Untitled" ):FIRST_BIN << Set Property(
	"Value Colors",
	{"The first Bin Fail" = -13912408}
);
Wait( 1 );
:FIRST_BIN << Color Cell by Value( 1 );

There might be some improvement and changes (color, datatable name, ...) to do with this code, in order to better handle missing values or other possible values, but it does color in red those cell values : 

Victor_G_0-1677148668326.png

I hope this will help you.

Victor GUILLER
Scientific Expertise Engineer
L'Oréal - Data & Analytics
jthi
Super User

Re: Color specific column by JSL

Scripting index has quite good examples on how to use << Color cells (it is used to color specific rows in specific column). Below is a slight modification from an example

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
rows_to_color = dt << Get Rows Where(:age == 13);
wait(1);
Column(dt, "age") << Color Cells("Red", rows_to_color);

Using Value Colors column property is also a good option like @Victor_G suggested

-Jarmo