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
lala
Level VIII

How can select data based on the value of another data table?

For example, using the "Big class.jMP "data, select the number of rows whose "age" corresponds to the value of another table.

2020-06-23_11-53.png

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How can select data based on the value of another data table?

Here is a simple example to do the selections you want

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

// Create the config table
dtCon = New Table( "Config", New Column( "Col", values( {13, 15} ) ) );

// Select the data based upon the values in the Config table
dt << clear select;
For( i = 1, i <= N Rows( dtCon ), i++,
	dt << select where( :age == dtCon:Col[i], current selection( "extend" ) )
);
Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: How can select data based on the value of another data table?

Here is a simple example to do the selections you want

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

// Create the config table
dtCon = New Table( "Config", New Column( "Col", values( {13, 15} ) ) );

// Select the data based upon the values in the Config table
dt << clear select;
For( i = 1, i <= N Rows( dtCon ), i++,
	dt << select where( :age == dtCon:Col[i], current selection( "extend" ) )
);
Jim
lala
Level VIII

Re: How can select data based on the value of another data table?

Thank Jim!

Again, There going to use the loop.
lwx228
Level VIII

Re: How can select data based on the value of another data table?

d1 = Current Data Table();
d2 = Open( "$SAMPLE_DATA/Big Class.jmp" );
d2 << Update( With( d1 ), Match Columns( :age = :age ), Add Columns from Update table( :col ) );
d2 << Select Where( :col > 0 );
d3 = d2 << Subset( Output Table( "test" ), Selected Rows( 1 ), selected columns( 0 ) );

That's all I can do.