Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
Level I

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\");


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. 

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\" );
	Show( "no rows selected" )
Level I

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!