Page 1 of 1

SysTime & SysDate functions

Posted: July 1st, 2018, 7:48 am
by Marc-Olivier Z
Morning all users and administrators.

I'm working to design a new data entry and I want the date and time be generated by the system. So I used the functions sysdate() and systime().
But the matter is in the fact that time/date update each time I have to move on again time/date question. I would like it keeps the values which appear the first time I moved on those questions.
Please, how should I do that???

Thanks for your answers!!!

Re: SysTime & SysDate functions

Posted: July 1st, 2018, 12:31 pm
by Gregory Martin
You can do something like this:
PROC FIRST_TIME

preproc

    if visualvalue(FIRST_TIME) = notappl then
        FIRST_TIME = systime();
    endif;

Re: SysTime & SysDate functions

Posted: July 2nd, 2018, 5:47 am
by Marc-Olivier Z
Thanks very much Gregory
It works now as I wanted :D

Re: SysTime & SysDate functions

Posted: January 9th, 2019, 3:36 am
by arkagwa
Dear Josh

I have similar case for the GPS. I want to keep the GPS i obtained in 30 minutes ago because enumerators move around. When they move around they do try to review the interviews may be they captured wrong (street name or village), on the other hand the GPS changes and also we lose the actual location of the study.

How to avoid this problem as the one proposed in system date above :)

Re: SysTime & SysDate functions

Posted: January 9th, 2019, 5:26 am
by josh
The approach for GPS would be exactly the same as for the date. Instead of FIRST_TIME use the variables you use to store latitude and longitude.

Re: SysTime & SysDate functions

Posted: January 15th, 2019, 10:24 am
by arkagwa
Dear Josh, Thanks works very well

Re: SysTime & SysDate functions

Posted: April 22nd, 2019, 10:50 am
by khadija
Hi everyone !
I have the same problem. I tried this proposal but it doesn't work because I put the item "time" in alpha. This is because I want to use the function ($=edit("99:99",systime()).

Can you help me please ?

Re: SysTime & SysDate functions

Posted: April 23rd, 2019, 10:33 am
by Gregory Martin
With alpha fields you don't have to use visualvalue because you always get the "visual value," so you can just write:
PROC FIELD

preproc

    if $ = "" then
        $ = edit("99:99",systime());
    endif;