Started by khann ·
2010-03-24 09:01 UTC ·
10 replies · SMF topic #1231
khann
2010-03-24 09:01 UTC
(setq *Inst_Day_Text "20100230")
(setq *YYYY (substr *Inst_Day_Text 1 4))
(setq *MM (substr *Inst_Day_Text 5 2))
(setq *DD (substr *Inst_Day_Text 7 2))
(setq *Temp_Date (list (read (strcat *YYYY ".0")) (read *MM) (read *DD)))
(setq *Chk_Date (dcl_Calendar_SetCurSel Calendar_form_calTemp *Temp_Date))
Hi,
The above is my test code of dcl_Calendar_SetCurSel to check the
*Inst_Day_Text is valid.
I need the T or nil return value but this returns ADS request error.
Someone help this, please.
Thanks.
fred_tomke
2010-03-24 09:39 UTC
Hi, don't use (list 2010 3 024) for date but (list 2010.0 3 24) for the date.
Fred
Kerry Brown
2010-03-24 09:53 UTC
Fred
in the posted example *Temp_Date will evaluate to (2010.0 2 30), so I don't think that's the trouble.
khann
2010-03-24 09:53 UTC
Hi, Fred.
Yes. I did.
(strcat *YYYY ".0")
I checked this list : (2010.0 2 30) .
I need the nil Return.
fred_tomke
2010-03-24 11:12 UTC
author=Kerry Brown link=topic=1231.msg6577#msg6577 date=1269424389 wrote:
in the posted example *Temp_Date will evaluate to (2010.0 2 30), so I don't think that's the trouble.
Sorry, my look was too short to recognize this. I'm just at a customer training.
Fred
owenwengerd
2010-03-24 13:17 UTC
author=khann link=topic=1231.msg6574#msg6574 date=1269421263 wrote:
I need the T or nil return value but this returns ADS request error.
The exception is by design. Since there are potentially other reasons why the function might return NIL, I don't think it's a good idea to use that function for the purpose of validating a date, however I'm open to other opinions.
khann
2010-03-25 00:47 UTC
Hi.
I was coding Date Validation routine.
*Inst_Day_Text is 8 digit formatted user input string.
For checking leap year February's 29 day, I tried the
dcl_Calendar_SetCurSel .
Has got any better idea?
owenwengerd
2010-03-25 03:50 UTC
It's a kludge, but you can do something like this:
(defun ValidateDate (date / result)
(dcl_suppressmessages T)
(setq result (vl-catch-all-apply 'dcl_calendar_setcursel (list date)))
(dcl_suppressmessages NIL)
result
)
You could also get fancy and use the ActiveX Windows date time picker control in a similar way.
khann
2010-03-25 04:54 UTC
Thanks, it's so good.
And you tell me the usage of dcl_suppressmessages
But I wonder the Help page of "dcl_Calendar_SetCurSel "
-----------------------------------------------------------------------------------------------------
Syntax : (dcl_Calendar_SetCurSel form_Calendar Date [as Date])
Return Type : Boolean (T if successful; otherwise NIL)
-----------------------------------------------------------------------------------------------------
If it fails why does not return NIL ?
owenwengerd
2010-03-25 06:06 UTC
When a function throws an exception, it does not return.
khann
2010-03-25 06:53 UTC
Mmm. I see.
Thanks for your reply.