cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
lala
Level VIII

How can JSL enable the cursor to click on a cell and the same value of the other columns of the table to automatically highlight the cell?

For example, use the following JSL to copy the name column of the big class two more columns.
How to use JSL: When the cursor clicks on a cell, the cell automatically sets the background to red for the same value in other columns of the table.

Thanks!

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Where( 1 );
dt << Select Columns( "name" );
d2 = dt << Subset( Output Table( "t" ), Selected Rows( 1 ), columns( name ) );
Column( d2, 1 ) << set name( "n1" );
dt << Sort( By( 4 ), Order( Descending ), replace table );
dt << Update( With( d2 ) );
Close( d2, nosave );
dt << Select Where( 1 );
dt << Select Columns( "name" );
d2 = dt << Subset( Output Table( "t" ), Selected Rows( 1 ), columns( name ) );
Column( d2, 1 ) << set name( "n2" );
dt << Sort( By( 5 ), Order( Descending ), replace table );
dt << Update( With( d2 ) );
Close( d2, nosave );

2023-08-22_21-42-38.png

4 REPLIES 4
mmarchandTSI
Level V

Re: How can JSL enable the cursor to click on a cell and the same value of the other columns of the table to automatically highlight the cell?

You'll need to add an Event Handler to :name.  I think this is what you're looking for:

 

Function( {thisTable, thisColumn, iRow},
	{},
	n1rows = thisTable << Get Rows Where( :n1 == thisTable:thisColumn[iRow] );
	n2rows = thisTable << Get Rows Where( :n2 == thisTable:thisColumn[iRow] );
	thisTable << Select Columns( {thisColumn, :n1, :n2} ) << Clear Cell Colors;
	thisColumn << Color Cells( {3, {iRow}} );
	:n1 << Color Cells( {3, n1rows} );
	:n2 << Color Cells( {3, n2rows} );
);

Add the Column Property:

 

mmarchandTSI_0-1692715894254.png

 

Hope that helps!

lala
Level VIII

Re: How can JSL enable the cursor to click on a cell and the same value of the other columns of the table to automatically highlight the cell?

Thanks!

 

    • How can I remove the color from the first click?

2023-08-23_07-40-57.png

lala
Level VIII

Re: How can JSL enable the cursor to click on a cell and the same value of the other columns of the table to automatically highlight the cell?

  • 15 version of the new click, the last color can be automatically eliminated

  • Thanks!
lala
Level VIII

Re: How can JSL enable the cursor to click on a cell and the same value of the other columns of the table to automatically highlight the cell?

  • How do I use JSL to automatically write this code to the properties of the name column?

Thanks!