BookmarkSubscribe
Choose Language Hide Translation Bar
Community Trekker

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.

``````//// 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
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
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