cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
joydeepb83
Level I

Select and color rows

Hi I am writing the following code to achieve the following. Could anyone please help. For some reason the code is not working. 

Thanks Joydeep

 

Objective. 

 

I am opening Table 1, Then getting summary of Table 1 and save it to table 2. 

Now for each row in the Table 2, I want to color the rows of Table 1. 

So I am running For loop in Table to select each row and based on that trying to color the row of Table 1. 

 

I would appreciate your help. 

 

//// Here is the code I am trying
 
 
dt10= open("\\Test\Table1.jmp");
 
dt11= dt10 << Summary(
Group(:Work Week ),
Freq( "None" ),
Weight( "None" )
);
x= N Row(dt11);
v= N Rows(dt10);
For(i=1,i <=x, i++,
dt11 << Select Rows(i) ;

For (j=1,j<=v, j++, dt10 << current data table();

if ( Row State(dt10,j) == "Selected" , Column( dt10, "Work Week") << Color Cells( i,{j} ));


);
dt11 << clear selection();
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Select and color rows

Try this:

dt10 = Open( "\\Test\Table1.jmp" );

dt11 = dt10 << Summary( Group( :Work Week ), Freq( "None" ), Weight( "None" ) );

x = N Row( dt11 );
v = N Rows( dt10 );

For( i = 1, i <= x, i++,
	dt11 << Select Rows( i );
	dt10:Work Week << color cells( "Red")	
	dt11 << clear selection();
);
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Select and color rows

Try this:

dt10 = Open( "\\Test\Table1.jmp" );

dt11 = dt10 << Summary( Group( :Work Week ), Freq( "None" ), Weight( "None" ) );

x = N Row( dt11 );
v = N Rows( dt10 );

For( i = 1, i <= x, i++,
	dt11 << Select Rows( i );
	dt10:Work Week << color cells( "Red")	
	dt11 << clear selection();
);
Jim