<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How do I make a date/time box fuction with alternative text inputs? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-make-a-date-time-box-fuction-with-alternative-text/m-p/867896#M103072</link>
    <description>&lt;P&gt;The script I'm working on has this function that creates a datebox with a default value as the argument, and if the user enters something that can't be recognized as a date, it sets the text back to that default value.&amp;nbsp; I want to add a feature where if you type certain keywords into the datebox, it will trigger it to do a certain behavior.&amp;nbsp; For example if the user types "yesterday" it will set the date/time to the beginning of the previous day.&lt;/P&gt;
&lt;P&gt;I can't figure out how to make the function check for these key words before it converts the text back to the default value due to not being a proper date.&amp;nbsp; Any pointers on how to accomplish this?&lt;/P&gt;
&lt;P&gt;(using JMP 17, but ideally it would work with the newer versions as well)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;timeBox = Function( {time},   
	Eval(
		Substitute(
		
			NameExpr( NumberEditBox(
				time,
				10, //width
				&amp;lt;&amp;lt; SetFunction( Function( {self}, {},
					If( IsMissing(self &amp;lt;&amp;lt; get), self &amp;lt;&amp;lt; Set(Eval(dummy)) );
				) ),
				&amp;lt;&amp;lt; Set Format( Format( "m/d/y h:m:s", 23, 0 ) );
			) ),
			
			Expr( dummy ), 
			
			time
			
		)
	);
);

timeEntryWindow = NewWindow( &amp;lt;&amp;lt; Modal, 
	PanelBox( "Start Time", startTimeBox = timeBox( Today() - 12*60*60 ) )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 12 Apr 2025 06:19:16 GMT</pubDate>
    <dc:creator>PromtheusXavier</dc:creator>
    <dc:date>2025-04-12T06:19:16Z</dc:date>
    <item>
      <title>How do I make a date/time box fuction with alternative text inputs?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-make-a-date-time-box-fuction-with-alternative-text/m-p/867896#M103072</link>
      <description>&lt;P&gt;The script I'm working on has this function that creates a datebox with a default value as the argument, and if the user enters something that can't be recognized as a date, it sets the text back to that default value.&amp;nbsp; I want to add a feature where if you type certain keywords into the datebox, it will trigger it to do a certain behavior.&amp;nbsp; For example if the user types "yesterday" it will set the date/time to the beginning of the previous day.&lt;/P&gt;
&lt;P&gt;I can't figure out how to make the function check for these key words before it converts the text back to the default value due to not being a proper date.&amp;nbsp; Any pointers on how to accomplish this?&lt;/P&gt;
&lt;P&gt;(using JMP 17, but ideally it would work with the newer versions as well)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;timeBox = Function( {time},   
	Eval(
		Substitute(
		
			NameExpr( NumberEditBox(
				time,
				10, //width
				&amp;lt;&amp;lt; SetFunction( Function( {self}, {},
					If( IsMissing(self &amp;lt;&amp;lt; get), self &amp;lt;&amp;lt; Set(Eval(dummy)) );
				) ),
				&amp;lt;&amp;lt; Set Format( Format( "m/d/y h:m:s", 23, 0 ) );
			) ),
			
			Expr( dummy ), 
			
			time
			
		)
	);
);

timeEntryWindow = NewWindow( &amp;lt;&amp;lt; Modal, 
	PanelBox( "Start Time", startTimeBox = timeBox( Today() - 12*60*60 ) )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Apr 2025 06:19:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-make-a-date-time-box-fuction-with-alternative-text/m-p/867896#M103072</guid>
      <dc:creator>PromtheusXavier</dc:creator>
      <dc:date>2025-04-12T06:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make a date/time box fuction with alternative text inputs?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-make-a-date-time-box-fuction-with-alternative-text/m-p/867926#M103073</link>
      <description>&lt;P&gt;As it is &lt;STRONG&gt;NUMBER&lt;/STRONG&gt; edit box it "can" only accept numbers. Start with something very simple and test it out in different ways (you will end up with missing values if you input text)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

nw = new window("",
	neb = Number Edit Box(.)
);

neb &amp;lt;&amp;lt; Set Function(function({this},
	show(this &amp;lt;&amp;lt; get)
));
/*
neb &amp;lt;&amp;lt; Set Number Changed(function({this, val},
	show(this &amp;lt;&amp;lt; get);
	show(val);
));
*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could create dropdown/button to set the yesterday value OR you could use text edit box and build custom calendar box / number edit box with that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Apr 2025 09:27:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-make-a-date-time-box-fuction-with-alternative-text/m-p/867926#M103073</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-04-12T09:27:31Z</dc:date>
    </item>
  </channel>
</rss>

