cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to use Accelerated Life Testing (ALT) to evaluate reliability. Register for June 5 webinar, 2pm US Eastern Time.

Discussions

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

Date Calendar box

I'm trying to make a jmp application that will run trends. I have two calendar boxes with a "From" and "To" date. When I click the "Run Script" button, I want to be able to use dates defined in the calendar boxes to select dates in my trend. How can I get the values from the calendar boxes to use in the script?

 

 

 

B1234_0-1649247204643.png

 

5 REPLIES 5
B1234
Level III

Re: Date Calendar box

This is what I have tried but doesnt seem to work

NumberEdit1 << set Function( Function( {this}, sd = NumberEdit1 << Get Date() ) );
NumberEdit2 << set Function( Function( {this}, ed = NumberEdit2 << Get Date() ) );

Show( sd );
startdate = Format( sd, "ddMonyyyy" );

Show( ed );
enddate = Format( ed, "ddMonyyyy" );

 

pmroz
Super User

Re: Date Calendar box

Try something like this:

nw = new window("Test Dates", << modal(),
	Lineup Box( N Col( 2 ),
		text box("Enter start date: "),
		start_neb = number edit box(today(), << Set Format( Format( "ddMonyyyy", 10))),
		text box("Enter end date: "),
		end_neb   = number edit box(today(), << Set Format( Format( "ddMonyyyy", 10))),
	),
	ok_button = button box("OK",
		startdate = start_neb << get;
		enddate   = end_neb << get;
	)
);

print(format(startdate, "ddMonyyyy" ), format(enddate, "ddMonyyyy" ));

pmroz_0-1649256418487.png

From the log:

"11Apr2022"
"24Apr2022"
pmroz
Super User

Re: Date Calendar box

Didn't realize you were using calendar boxes.  Try this:

nw = new window("Test Dates", << modal(),
	text box("Monitoring & Trending"),
	hlistbox(
		panelbox("From Date",
			cal_start = calendar box(<< Show Time( 0 )),
		),
		panelbox("To Date",
			cal_end = calendar box(<< Show Time( 0 )),
		),
	),
	ok_button = button box("OK",
		startdate = cal_start << get date;
		enddate   = cal_end << get date;
	)
);

print(format(startdate, "ddMonyyyy" ), format(enddate, "ddMonyyyy" ));
Craige_Hales
Super User

Re: Date Calendar box

you might like Select Date Range with Calendar Boxes Linked calendar boxesLinked calendar boxes

Craige
B1234
Level III

Re: Date Calendar box

thank you @pmroz and @Craige_Hales  this was very helpful! working well now thank you both. 

Recommended Articles