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
BHarris
Level VI

Get the value from a given column on the first selected row using JSL

I'm trying to simply get the value from a given column on the first selected row -- but somehow this is surprisingly hard.  Here's what I have so far:

 

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Probe.jmp" );
dt << Select Where( :Wafer Number == "16" & :Die X == 3);
selRow = ( dt << get selected rows() )[0];
Row() = selRow;
site = :Site;   // returns "1", should return "5" (:Site from row 15)

I expect "site" to end up with 5, but it ends up with 1.  What am I missing here?

 

Also note, I was trying something similar to this on a table with 33M rows, and JMP was unresponsive for several minutes.  I was experimenting with different ways to do this so I may have inadvertently asked it to first create a list of 33M things then to take the 14M-th item.  I hope whatever solution I end up with to the above question won't do that.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Get the value from a given column on the first selected row using JSL

You need to reference only the first [1] element in the Get Rows Where matrix

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Probe.jmp" );
dt << Select Where( :Wafer Number == "16" & :Die X == 3 );
site = :site[(dt << get selected rows())[1]];

// or

dt = Open( "$SAMPLE_DATA/Probe.jmp" );
site = :Site[(dt << get rows where( :Wafer Number == "16" & :Die X == 3 ))[1]];
Jim

View solution in original post

6 REPLIES 6
txnelson
Super User

Re: Get the value from a given column on the first selected row using JSL

You need to reference only the first [1] element in the Get Rows Where matrix

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Probe.jmp" );
dt << Select Where( :Wafer Number == "16" & :Die X == 3 );
site = :site[(dt << get selected rows())[1]];

// or

dt = Open( "$SAMPLE_DATA/Probe.jmp" );
site = :Site[(dt << get rows where( :Wafer Number == "16" & :Die X == 3 ))[1]];
Jim
BHarris
Level VI

Re: Get the value from a given column on the first selected row using JSL

So data in data tables is fundamentally stored as a set of columns which are each a list of entries?

 

(And yes, I'm a python coder so I missed the [0] -> [1] thing...)

 

Also, I scoured all of the JMP documentation sections that I thought might help and couldn't find anything on this, i.e. the :site[rowNumber] notation.  If someone knows where this is, I'd love to read that section of the documentation.

 

Thanks, Jim!

jthi
Super User

Re: Get the value from a given column on the first selected row using JSL

Data table subscripting is good post in community and you can find documentation from Scripting Guide Scripting Guide > Data Tables > Access Data Values is a good starting point. It provides additional links to other pages with more information

-Jarmo
BHarris
Level VI

Re: Get the value from a given column on the first selected row using JSL

@txnelson :  This approach takes the better part of a full second to return the value in a large table (33M rows).  The table otherwise behaves ok, so I'm thinking this approach may be doing something heavy-handed under the cover...  Are there other approaches I could test? 

 

--> UPDATE:  I just realized that it's the "Get Selected Rows()" call that's slow, not the data access.  Curious, seems like that should be fast.

txnelson
Super User

Re: Get the value from a given column on the first selected row using JSL

I typically use the Get Rows Where() over the Select Where, followed by the Get Selected Rows.  Unless you need the visual display of selected rows, I have always though it was faster.

Jim
BHarris
Level VI

Re: Get the value from a given column on the first selected row using JSL

@txnelson My true purpose was not the "select where", but instead that I'm clicking a point in one graph builder plot tied to data table (A), and I want to update the Data Filter in a Graph Builder plot tied to data table (B).  The first click selects the rows, then the JSL should grab the id field from the selected row of the first table, and then stick that value in the data filter on the Graph Builder B plot.

 

I got it working today (yeah!) using Get Selected Rows(), but it's just curious that-that function is relatively slow on large datasets.  Makes me think it's searching an invisible column for all of the "1"s or something...

 

Thanks for your help!