cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • 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.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

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

JSL Query Table: Strange result


dirLoc=Pick Directory("Select a directory", "my directory"); fileList = Files In Directory(dirLoc); dt1 = open(dirLoc || fileList[1]); dt1 << Select Where( :Amount>=1000 ); x=dt1<<Subset(Output Table Name("T1")); Close(dt1, NoSave); show(N Row(x)); x << Save("my directory\t1.jmp");

Greetings!

I am trying a simple query with a sample data file. The query returns right set of results if there is any record satisfying the condition in "Where" clause. But, in case, there exist no record satisfying the condition, it returns all the records where expected result is an empty set. Even, when I try to see how many records (N Row()) in the resultant set, it shows the count of total records.

Thanks for any suggestion and please let me know if I am missing anything. 

2 REPLIES 2
txnelson
Super User

Re: JSL Query Table: Strange result

I would handle this by checking to see if any rows were selected, and if so, then do the subset, and if not, then print out a message.

dirLoc = Pick Directory( "Select a directory", "my directory" );
fileList = Files In Directory( dirLoc );
dt1 = Open( dirLoc || fileList[1] );
dt1 << Select Where( :Amount >= 1000 );
If( Length( dt1 << get selected rows ) > 0,
	x = dt1 << Subset( Output Table Name( "T1" ) );
	Close( dt1, NoSave );
	Show( N Row( x ) );
	x << Save( "my directory\t1.jmp" );
,
	Show( "no rows selected" )
);
Jim
monir
Level II

Re: JSL Query Table: Strange result

Hi Jim,
Thanks for your quick reply. Actually, I am trying to concatenate the results, of the query, from multiple tables. Let me try your suggestion. Please share if you have any thoughts on that.

Thanks again! 

Recommended Articles