cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP Security Notice: CVE-2026-109618 and CVE-2026-109619

    JMP promptly initiated a review of its products, services, and relevant infrastructure for exposure to CVE-2026-109618 and CVE-2026-109619.

    Our assessment of JMP products has not identified exposure to these vulnerabilities. Where remediation was required within supporting environments, appropriate security updates and controls have been applied and validated.

    We have identified no evidence of successful exploitation or unauthorized access to JMP systems or customer information associated with these vulnerabilities.

    JMP continues to monitor the issue and relevant vendor guidance. No action is required by JMP customers at this time.

  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
ALopez
Level III

How to use a list to select rows with an specific value

Hi I am trying to use a list of Names that populate a column to select the matching rows of another column (in another Table) in order to subset the table and generate several different subsets.

Getting the Names/Values from the first column is no problem but I cannot find the correct syntax for the loop.

dt4 = Current Data Table();
uniqueVals = {"2021_file1_T1", "2021_file1_T2"};

tableList= {};

For(i=1, i< N Items(uniqueVals), i++,
dt4 << select where( As Column("Type") == [i] ) );
dt4 << Select Columns (all);
newdt[i] = dt4 << Subset( Selected columns );
Insert Into(tableList, Data Table(newdt[i]));
dt4 << Clear Column Selection();
dt4 << Clear Select();
);// end of For

I think that my basic logic is OK  since this code works very well

dt4 << select where( As Column("Type") =="2021_file1_T2");
dt4 << Select Columns(all);
dt4 << Subset (Selected columns);

But I cannot figure out how to pass [i] to the "Select Where".  Attached is a simplified test table.
I will appreciate any hints/ solution/suggestions.

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to use a list to select rows with an specific value

You were pretty close in getting done what you want.  Below is my rework of your code.  Please note that your tableList list is redundant with the newdt list that you are referencing.

dt4 = Current Data Table();
uniqueVals = {"2021_file1_T1", "2021_file1_T2"};

//tableList = {};
newdt = {};

For( i = 1, i <= N Items( uniqueVals ), i++,
	dt4 << select where( As Column( "Type" ) == uniqueVals[i] );
	dt4 << Select Columns( all );
	newdt[i] = dt4 << Subset( Selected columns );
	//Insert Into( tableList, Data Table( newdt[i] ) );
	dt4 << Clear Column Selection();
	dt4 << Clear Select();
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How to use a list to select rows with an specific value

You were pretty close in getting done what you want.  Below is my rework of your code.  Please note that your tableList list is redundant with the newdt list that you are referencing.

dt4 = Current Data Table();
uniqueVals = {"2021_file1_T1", "2021_file1_T2"};

//tableList = {};
newdt = {};

For( i = 1, i <= N Items( uniqueVals ), i++,
	dt4 << select where( As Column( "Type" ) == uniqueVals[i] );
	dt4 << Select Columns( all );
	newdt[i] = dt4 << Subset( Selected columns );
	//Insert Into( tableList, Data Table( newdt[i] ) );
	dt4 << Clear Column Selection();
	dt4 << Clear Select();
);
Jim
ALopez
Level III

Re: How to use a list to select rows with an specific value

Hi @txnelson, So close yet so far.... Thank you very much for your help. 

Recommended Articles