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
AT
AT
Level VI

Interactive date selection and filtering by SQL

I like to use JMP interative to get input start and end time and then use SQL to filter the data table. The parameter dateb and datee if defined as for instance '2017-10-10', '2017-11-11' works fine but when use assigned varaible dateb and datee, I don't get the correct filtering (empty tables).

I appreciate any help you can provide. Thanks.

------------------------------------

 

 

defuplim = Today();

deflowlim = Today() - In Days( 730 );

 

ww = New Window( "Pick Your Dates in yyyy-mm-dd format",

<<Modal,

<<return result,

V List Box(

Text Box( "Start Date:" ),

str1 = Number Edit Box(

deflowlim,

10,

<<SetFunction(

Function( {that},

lowlim = str1 << get

)

)

),

Text Box( "End Date:" ),

str2 = Number Edit Box(

defuplim,

10,

<<SetFunction(

Function( {this},

uplim = str2 << get

),

 

)

),

str1 << set format( Format( "yyyy-mm-dd" ) ),

str2 << set format( Format( "yyyy-mm-dd" ) )

),

H List Box( Button Box( "OK" ), Button Box( "Cancel" ) ),

       

);

 

 

dateb = As date(ww["str1"]);

datee = As date(ww["str2"]);

 

dateb = format(dateb,"yyyy-mm-dd");

datee = format(datee,"yyyy-mm-dd");

 

dt1 = Open Database(

"DSN=XXX;UID=root;PWD=xxxxx;",

"Select * from xyz where date(starttime) between 'dateb' and 'datee'","TMP"

 

);

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Interactive date selection and filtering by SQL

See if this modification will work

defuplim = Today();
deflowlim = Today() - In Days( 730 );

ww = New Window( "Pick Your Dates in yyyy-mm-dd format", 
	<<Modal, 
	<<return result, 
	V List Box(
		Text Box( "Start Date:" ), 
		str1 = Number Edit Box(
			deflowlim, 
			10, 
			<<SetFunction(
				Function( {that}, 
					lowlim = str1 << get
				)
			)
		), 
		Text Box( "End Date:" ), 
		str2 = Number Edit Box(
			defuplim, 
			10, 
			<<SetFunction(
				Function( {this}, 
					uplim = str2 << get
				), 
			)
		), 
		str1 << set format( Format( "yyyy-mm-dd" ) ), 
		str2 << set format( Format( "yyyy-mm-dd" ) )
	), 
	H List Box( Button Box( "OK" ), Button Box( "Cancel" ) ),        
);

dateb = As Date( ww["str1"] );
datee = As Date( ww["str2"] );

dateb = Format( dateb, "yyyy-mm-dd" );
datee = Format( datee, "yyyy-mm-dd" );

Eval(
	Parse(
		"dt1 = Open Database(
	\!"DSN=XXX;UID=root;PWD=xxxxx;\!", 
	\!"Select * from xyz where date(starttime) between '"
		 || dateb || "' and '" || datee || "',\!"TMP\!");"
	)
);
Jim

View solution in original post

3 REPLIES 3
pmroz
Super User

Re: Interactive date selection and filtering by SQL

You need to convert your string dates back into dates for the database to understand them.  If this is Oracle you need a statement like:

sql_statement = evalinsert(
"Select * 
   from xyz 
  where date(starttime) between to_date('^dateb^', 'YYYY-MM-DD')
                            and to_date('^datee^', 'YYYY-MM-DD') ");

dt1 = Open Database("DSN=XXX;UID=root;PWD=xxxxx;", sql_statement);
txnelson
Super User

Re: Interactive date selection and filtering by SQL

See if this modification will work

defuplim = Today();
deflowlim = Today() - In Days( 730 );

ww = New Window( "Pick Your Dates in yyyy-mm-dd format", 
	<<Modal, 
	<<return result, 
	V List Box(
		Text Box( "Start Date:" ), 
		str1 = Number Edit Box(
			deflowlim, 
			10, 
			<<SetFunction(
				Function( {that}, 
					lowlim = str1 << get
				)
			)
		), 
		Text Box( "End Date:" ), 
		str2 = Number Edit Box(
			defuplim, 
			10, 
			<<SetFunction(
				Function( {this}, 
					uplim = str2 << get
				), 
			)
		), 
		str1 << set format( Format( "yyyy-mm-dd" ) ), 
		str2 << set format( Format( "yyyy-mm-dd" ) )
	), 
	H List Box( Button Box( "OK" ), Button Box( "Cancel" ) ),        
);

dateb = As Date( ww["str1"] );
datee = As Date( ww["str2"] );

dateb = Format( dateb, "yyyy-mm-dd" );
datee = Format( datee, "yyyy-mm-dd" );

Eval(
	Parse(
		"dt1 = Open Database(
	\!"DSN=XXX;UID=root;PWD=xxxxx;\!", 
	\!"Select * from xyz where date(starttime) between '"
		 || dateb || "' and '" || datee || "',\!"TMP\!");"
	)
);
Jim
AT
AT
Level VI

Re: Interactive date selection and filtering by SQL

Thanks so much Jim. It worked perfectley.

Recommended Articles