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. I want to add a feature where if you type certain keywords into the datebox, it will trigger it to do a certain behavior. For example if the user types "yesterday" it will set the date/time to the beginning of the previous day.
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. Any pointers on how to accomplish this?
(using JMP 17, but ideally it would work with the newer versions as well)
timeBox = Function( {time},
Eval(
Substitute(
NameExpr( NumberEditBox(
time,
10, //width
<< SetFunction( Function( {self}, {},
If( IsMissing(self << get), self << Set(Eval(dummy)) );
) ),
<< Set Format( Format( "m/d/y h:m:s", 23, 0 ) );
) ),
Expr( dummy ),
time
)
);
);
timeEntryWindow = NewWindow( << Modal,
PanelBox( "Start Time", startTimeBox = timeBox( Today() - 12*60*60 ) )
);