cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP 19 is here! See the new features at jmp.com/new.
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
Choose Language Hide Translation Bar

get row number of value contain in a column without select row

Hi all,

 

I want to get the row number of a value (for example : "Value_A") that might be contained in a column (called "Column_A") without using the following code :  

 

rmat = dt << get rows where( Contains( Column( dt, "Column_A" )[], "Value_A" ) );
Try( row_number_wanted = rmat[1] );

 

I don't want to use such code because it takes too much time when a lot of values in a big datatable need to be retrived.

 

Is there a way ?

1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XII

Re: get row number of value contain in a column without select row

in JMP18, Where() was introduced as a faster alternative to get rows where().

 

On the other hand, Get rows where(Contains()) is quite fast for what it has to do.
Can you give an example what "too much time" means? How many rows are there in the data table ?

 

dt = Open( "$SAMPLE_DATA/Aircraft Incidents.jmp" );
dt= dt << concatenate({dt,dt,dt,dt,dt,dt,dt,dt});
wait(0);
dt= dt << concatenate({dt,dt,dt,dt,dt,dt,dt,dt});
t0=hptime(); current data table() << get rows where(contains(:location, "SD")); show(nrows(),(hptime()-t0)/1000000); t0=hptime(); where(dt,contains(:location, "SD")); show(nrows(),(hptime()-t0)/1000000); close(dt, noSave);

 

View solution in original post

2 REPLIES 2
hogi
Level XII

Re: get row number of value contain in a column without select row

in JMP18, Where() was introduced as a faster alternative to get rows where().

 

On the other hand, Get rows where(Contains()) is quite fast for what it has to do.
Can you give an example what "too much time" means? How many rows are there in the data table ?

 

dt = Open( "$SAMPLE_DATA/Aircraft Incidents.jmp" );
dt= dt << concatenate({dt,dt,dt,dt,dt,dt,dt,dt});
wait(0);
dt= dt << concatenate({dt,dt,dt,dt,dt,dt,dt,dt});
t0=hptime(); current data table() << get rows where(contains(:location, "SD")); show(nrows(),(hptime()-t0)/1000000); t0=hptime(); where(dt,contains(:location, "SD")); show(nrows(),(hptime()-t0)/1000000); close(dt, noSave);

 

Re: get row number of value contain in a column without select row

Thanks a lot hogi!

 

It took me more than 1 hour with the Get rows where(Contains(). I had to stop it a some point.

 

With Where() it took less than 1 minute! Perfect!

 

Thanks again!

 

 

Recommended Articles