SysTime & SysDate functions

Discussions about editing and cleaning data
Forum rules
New release: CSPro 8.0
Post Reply
Marc-Olivier Z
Posts: 16
Joined: September 30th, 2016, 12:48 pm

SysTime & SysDate functions

Post 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!!!
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: SysTime & SysDate functions

Post by Gregory Martin »

You can do something like this:
PROC FIRST_TIME

preproc

    if visualvalue(FIRST_TIME) = notappl then
        FIRST_TIME = systime();
    endif;
Marc-Olivier Z
Posts: 16
Joined: September 30th, 2016, 12:48 pm

Re: SysTime & SysDate functions

Post by Marc-Olivier Z »

Thanks very much Gregory
It works now as I wanted :D
arkagwa
Posts: 119
Joined: November 18th, 2014, 5:25 am

Re: SysTime & SysDate functions

Post 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 :)
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: SysTime & SysDate functions

Post 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.
arkagwa
Posts: 119
Joined: November 18th, 2014, 5:25 am

Re: SysTime & SysDate functions

Post by arkagwa »

Dear Josh, Thanks works very well
khadija
Posts: 1
Joined: April 22nd, 2019, 10:27 am

Re: SysTime & SysDate functions

Post 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 ?
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: SysTime & SysDate functions

Post 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;
Post Reply