Help needed: Assigning current date to a data element

Hi all,

I am Selvaraj Muthusamy from PCI, Botswana. We have customised DHIS2 (2.29) to manage our OVC database. We are using Tracker App to capture the individual case management.

We have a field (data element) called “Data entered on” and this has to be the current date and time. I created a data element “Data entered on” as “Date” type. Now I want to assign the current date and time automatically to this field when the form is opened. Unfortunately, I am failing to set this up through a program rule. I could not find a function or system variable to use for this purpose.

Any help is highly appreciated.

···

Thanks and regards

MSP

Dear MSP

I am not sure if you are aware, but see the following documentation for the codes used to create the “current date” in the program rule.

https://docs.dhis2.org/2.30/en/user/html/configure_program_rule.html

Please see **Table 21.14. Standard variables to use in program rule expressions **

From what I am aware, these variables are applicable to past versions also (therefore should work for 2.29 and 2.28 as I have used them in 2.28).

I hope this helps.

Kind regards,

Terence

···

Terence Scott

Global Alliance for Rabies Control (GARC)

Pan-African Rabies Control Network (PARACON) Steering Committee

terence.scott@rabiesalliance.org

https://paracon.rabiesalliance.org

Skype: tpscott1987

Thank you very much Mr.Terence :pray: for pointing to the right direction. It worked.:grin:

···

Thanks and regards

MSP

Glad to hear it!

···

Terence Scott

Global Alliance for Rabies Control (GARC)

Pan-African Rabies Control Network (PARACON) Steering Committee

terence.scott@rabiesalliance.org

https://paracon.rabiesalliance.org

Skype: tpscott1987

Hi @Terence_Scott @dhis2-tracker,

Any ideas on how to capture ‘current time only’ similarly like ‘current date’ is captured?

Sorry, I am not sure how to do time only… Surely you would want to include the date also, as otherwise this would become extremely confusing and difficult to manage based on time alone?

Would you be able to provide an example of the use (for my interest’s sake)?

Thanks @Terence_Scott,

Sorry I was not very clear. How about both? If i needed to capture both ‘current date’ and ‘current time’. Any ideas on how to do that?

You should be able to track this through the audit feature. This is available in the documentation here: Home - DHIS2 Documentation

Others also may have some additional suggestions for you.

Good luck!