cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Jackie_
Level VI

Search where

Hi,

 

I want to select all rows containing value > 5. In the following script I used for, if and contain statement to select columns containing string "SE" and to highlight row containing values > 5 from the selected column I used the select where( Row() > 5) but doesn't work. 

Names Default To Here( 1 );
Clear Globals();
Clear log();

dt = Open("$SAMPLE_DATA/Water Treatment.jmp");
dt << Clear Column Selection();
Col_List = dt << Get Column Names("String");

for(u = 1, u <= N Items(Col_List),u++,
If(Contains(Col_List[u], "SE"),
 Column(Col_List[u]) << Set Selected(1);
 
);
);
dt << Select where( Row() > 5);
 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jackie_
Level VI

Re: Search where

It worked

 

Names Default To Here( 1 );
Clear Globals();
Clear log();

dt = Open("$SAMPLE_DATA/Water Treatment.jmp");
dt << Clear Column Selection();
Col_List = dt << Get Column Names("String");
list = {};
for(u = 1, u <= N Items(Col_List),u++,
If(Contains(Col_List[u], "ZN"),
Column(Col_List[u]) << Set Selected (1);
	Insert Into(list, Col_List[u]),
);
);

dt << Select where(as column(list) > 5 );

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Search where

dt << Select where( Row() > 5);

is specifying to select all rows, where the row number(row()) is greater than 5.

 

What you need to do is to replace Row() with the column whos values you want to  select if greater than 5.

 

Check out the documentation on Select Where() in the Scripting Index.  

Jim
Jackie_
Level VI

Re: Search where

Hi @txnelson ,

 

Still not working. Thoughts?

Names Default To Here( 1 );
Clear Globals();
Clear log();

dt = Open("$SAMPLE_DATA/Water Treatment.jmp");
dt << Clear Column Selection();
Col_List = dt << Get Column Names("String");
list = {};
for(u = 1, u <= N Items(Col_List),u++,
If(Contains(Col_List[u], "SED-E"),
Column(Col_List[u]) << Set Selected (1);
	Insert Into(list, Col_List[u]),
);
);
dt << Select where(Column(Eval(list)) > 6)
Jackie_
Level VI

Re: Search where

It worked

 

Names Default To Here( 1 );
Clear Globals();
Clear log();

dt = Open("$SAMPLE_DATA/Water Treatment.jmp");
dt << Clear Column Selection();
Col_List = dt << Get Column Names("String");
list = {};
for(u = 1, u <= N Items(Col_List),u++,
If(Contains(Col_List[u], "ZN"),
Column(Col_List[u]) << Set Selected (1);
	Insert Into(list, Col_List[u]),
);
);

dt << Select where(as column(list) > 5 );
txnelson
Super User

Re: Search where

Your solution will only work if only one column is found when you use the 

If(Contains(Col_List[u], "ZN"),

If you use:

If(Contains(Col_List[u], "SS"),

and set the select to 

dt << Select where(as column(list) > 179);

you will see that the rows are selected based upon only the first column in your "list"

Jim