Jim, define vWorkDate before using it to obtain the date.
SET VAR vWorkDate DATE = NULL
SET VARIABLE vWorkDate = (GETDATE('Select Work Date to Edit'))
IF vWorkDate IS NULL THEN
GOTO done
ENDIF
EDIT USING KayParkDaywork WHERE WorkDate = .vWorkDate
CLEAR VAR vworkDate
LABEL done
RETURN
The above will work whether they use the ESC key or use the Cancel button on
the form.
Gary
________________________________
From: Jim Belisle <[email protected]>
To: RBASE-L Mailing List <[email protected]>
Sent: Thursday, May 7, 2009 7:59:48 AM
Subject: [RBASE-L] - RE: [No Subject]
Before receiving your message below, I tried the GETDATE function that brings
up the calendar. This is what I started with:
SET DATE MM/DD/YYYY
SET VARIABLE vendkey = (LASTKEY(0))
SET VARIABLE vWorkDate = (GETDATE('Select Work Date to Edit'))
IF vendkey = '[Esc]' THEN
GOTO done
ENDIF
EDIT USING KayParkDaywork WHERE WorkDate = .vWorkDate
CLEAR VAR vworkDate
LABEL done
RETURN
This works for getting the date but if I escape, I get an error message stating
there is no variable vworkdate. Where is my logic wrong?
Jim
________________________________
From:[email protected] [mailto:[email protected]] On Behalf Of Emmitt Dove
Sent: Thursday, May 07, 2009 7:50 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: [No Subject]
Try this:
LABEL getworkdate
SET VAR vworkdate DATE = .#DATE
SET VAR vcaption = ‘Work Date Selection’
SET VAR vdialmsg = ‘Please enter the work date to edit (double-click for
calendar):’
SET VAR vendkey TEXT
SET VAR vpoptitle = ‘Pick the Work Date’
DIALOG .vdialmsg .vworkdate=10 vendkey 1 CAPTION .vcaption OPTION
POPUP_ENABLED TRUE|POPUP_DIALOG_TYPE DATE +
|POPUP_TITLE_TEXT .vpoptitle|BUTTONS_SHOW_GLYPH ON|BUTON_OK_CAPTION
&OK|BUTTON_CANCEL_CAPTION &Cancel
IF vendkey = ‘[Esc]’ THEN
--- Do whatever
ENDIF
SET VAR vtestdate DATE = .vworkdate
IF vtestdate IS NULL THEN
PAUSE 2 USING ‘Error: the value entered is not a valid date.’ CAPTION
.vcaption BUTTON ‘OK’ ICON Warning
GOTO getworkdate
ENDIF
Emmitt Dove
Manager, Converting Applications Development
Evergreen Packaging, Inc.
[email protected]
(203) 214-5683 m
(203) 643-8022 o
(203) 643-8086 f
[email protected]
From:[email protected] [mailto:[email protected]] On Behalf Of Jim Belisle
Sent: Thursday, May 07, 2009 8:26 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: [No Subject]
Thanks, Emmitt. My programming skills are still very “Kindergarten” variety so
my questions are usually simple ones. I look at the examples in RRBYW14 and
read the help information but putting all the syntaxes together properly
sometimes gets me into trouble. I will have to get used to the DIALOG command.
Jim
________________________________
From:[email protected] [mailto:[email protected]] On Behalf Of Emmitt Dove
Sent: Thursday, May 07, 2009 7:22 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: [No Subject]
Jim,
Good programming practice requires that you always trap for any possible
outcomes. So, yes, do look for the escape key. You should also check that
your result is a valid date before proceeding.
Also, in Windows, try using the DIALOG command instead of FILLIN. With DIALOG,
you can specify the POPUP option and make the popup a GUI calendar.
Yet another option is the (GETDATE()) function.
Emmitt Dove
Manager, Converting Applications Development
Evergreen Packaging, Inc.
[email protected]
(203) 214-5683 m
(203) 643-8022 o
(203) 643-8086 f
[email protected]
From:[email protected] [mailto:[email protected]] On Behalf Of Jim Belisle
Sent: Thursday, May 07, 2009 8:04 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - [No Subject]
I use many simple EEP’s in the application I am building like the one below.
SET DATE MM/DD/YYYY
SET VARIABLE vWorkDate DATE
FILLIN vWorkDate=8 USING 'ENTER WORK DATE YOU ARE EDITING IN MMDDYYYY FORMAT. +
DO NOT USE SLASHES(/).'
EDIT USING KayParkDaywork WHERE WorkDate = .vWorkDate
CLEAR VAR vworkDate
RETURN
Is it always wise to have an IF THEN statement to care for the escape key (or
null) in case the user decides to get out of the form before entering the
information?
Jim
I use this in some of the menu choices:
IF vendkey = '[Esc]' THEN
GOTO done
ENDIF