Dear all,
I have used the following logic to pick the current date for interview date automatically
onfocus
$=edit("99/99/99",sysdate("DDMMYY"));
Then problem is that when viewing the record or modifying on a different day, the date changes to that day's date. How can I fix this?
Regards
Picking current date but changing when viewing the case
-
- Posts: 572
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: Picking current date but changing when viewing the case
Dear Tweg;
Please use this code:
If demode()=1 then
$=edit("99/99/99",sysdate("DDMMYY"));
else
endif;
a.
Please use this code:
If demode()=1 then
$=edit("99/99/99",sysdate("DDMMYY"));
else
endif;
a.
Re: Picking current date but changing when viewing the case
Dear Arshad,
Thanks for your reply it worked.
Regards
Thanks for your reply it worked.
Regards
Re: Picking current date but changing when viewing the case
It doesn't work to me.
Yours,
Kyaw Thet
Yours,
Kyaw Thet
Re: Picking current date but changing when viewing the case
Dear Arshard,
What wrong to me? This logic not working.
How to do that?
PROC DATE
onfocus
iF DATE=edit("99/99/9999",sysdate("DD/MM/YYYY"));
else
endif;
Yours,
Kyaw Thet
Myanmar
What wrong to me? This logic not working.
How to do that?
PROC DATE
onfocus
iF DATE=edit("99/99/9999",sysdate("DD/MM/YYYY"));
else
endif;
Yours,
Kyaw Thet
Myanmar
Re: Picking current date but changing when viewing the case
another way to code is :
PROC DATE
onfocus
if demode ()= 1 then
DATE=edit("99/99/9999",sysdate("DD/MM/YYYY"));
endif;
I am wondering why you are using the on focus, instead of Preproc,
PROC DATE
onfocus
if demode ()= 1 then
DATE=edit("99/99/9999",sysdate("DD/MM/YYYY"));
endif;
I am wondering why you are using the on focus, instead of Preproc,
Re: Picking current date but changing when viewing the case
As others have mentioned, this should be done in the preproc, not in the onfocus. The general rule is that anything that has to do with setting the value of the field is done in the preproc and anything that has to do with setting the question text and/or value set is done in onfocus.
Another alternative is to use check if the field is already filled in rather than using demode:
Another alternative is to use check if the field is already filled in rather than using demode:
PROC DATE
preproc
if $ = "" then
$=edit("99/99/99",sysdate("DDMMYY"));
endif;
The difference is that this will only set the field value once so even if you have a partially saved case and you return to the field while still in add mode the value will not change.preproc
if $ = "" then
$=edit("99/99/99",sysdate("DDMMYY"));
endif;
Re: Picking current date but changing when viewing the case
Dear all,
preproc
if demode ()= 1 then
DATE=edit("99/99/9999",sysdate("DD/MM/YYYY"));
endif;
I have to change the numeric to alpha (Date).
Thanks You for the guide & help.
Kyaw Thet
Myanmar
preproc
if demode ()= 1 then
DATE=edit("99/99/9999",sysdate("DD/MM/YYYY"));
endif;
I have to change the numeric to alpha (Date).
Thanks You for the guide & help.
Kyaw Thet
Myanmar
Re: Picking current date but changing when viewing the case
Yes. Edit returns an alphanumeric. If you want to store your date numeric then don't use edit:
DATE=sysdate("DDMMYYYY");
Re: Picking current date but changing when viewing the case
Hi
But how do I restrict it from changing if it has been entered
It's numeric not Alphanumeric
Thanks
But how do I restrict it from changing if it has been entered
Code: Select all
preproc
// Fill in interview date automatically based on current date
$ = sysdate("YYYYMMDD");
Thanks