cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
SamH
Level III

Select a group of cells in a column

Hi, I have table with thousands of rows. I need to be able to select a group of cells in one column, so I could copy it into another table. for example for Column: "Test3 (VOLTS)" only I need to copy cells highlighted in yellow from row 4 thru row 18 using JSL code.

Thanks

JMP.jpg

 

11 REPLIES 11
txnelson
Super User

Re: Select a group of cells in a column

Here is a simple example  of one way to do it

Names Default To Here( 1 );

dt = Open( "$sample_data\big class.jmp" );

// copy the names from row 2-6
NameCpy = dt:name[Index( 2, 6 )];

dt2 = New Table( "copied", New Column( "new name", character ) );
dt2 << add rows( 5 );

// copy to new table
For( i = 1, i <= 5, i++,
	dt2:new name[i] = NameCpy[i]
);

If you actually have physical rows that are selected, you can easily get their row number with a:

 

     dt<<get selected rows

Jim
SamH
Level III

Re: Select a group of cells in a column

Thanks that should work, I tried with Big class file.

Much appreciated

Sam.

SamH
Level III

Re: Select a group of cells in a column

Hi Jim, how can I select a range of cells withing one column?

for example if I want to select cell 2 thourgh cell 19 within the same column.

Because I want to use this selection to be able to do "Select Matching Cells" within the same column.

 

Thanks

Sam

txnelson
Super User

Re: Select a group of cells in a column

Here is the example for "Select Matching Cells" taken from

     Help==>Scripting Index

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Rows( [1, 2, 3, 4] );
dt << Go To( :Height );
Wait( 2 );
dt << Select Matching Cells();
Jim
SamH
Level III

Re: Select a group of cells in a column

Hi Jim, instead of hand picking what cells to select, can I pick a range let's say 2-19?

Thanks

 

SamH
Level III

Re: Select a group of cells in a column

or row 12 thru 40 in column "height"

SamH
Level III

Re: Select a group of cells in a column

col.jpg

SamH
Level III

Re: Select a group of cells in a column

Jim, I am trying to automate this process, because the files I am dealing with could have 1k-2k rows. if I have to specify every row, my code will be so many pages.
SamH
Level III

Re: Select a group of cells in a column

Jim, I figured it out, here is the code it works.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
L = N Rows( dt ); // number of rows
For( i = 3, i <= L, i++,
dt << Select Rows( i, L );
dt << Go To( :Height );
);
Wait( 2 );
dt << Select Matching Cells();