Using "if" with datediff to make conditional statements

70 views
Skip to first unread message

MB

unread,
Nov 23, 2017, 10:07:33 PM11/23/17
to Lifespan Redcap Users
Hi, I'm having trouble understanding the following statements. They work but I don't understand the whole code.

These statements are used as data quality checks.

Future date entered: Date of consent

if(datediff([date_of_consent],"today","d","dmy",true)< 0,"999","111") = '999' and [date_of_consent] <>''


Date of test at the time of HIV diagnosis is before the HIV diagnosis date

if(datediff([date_of_test_hiv],[date_of_hiv_1_diag],"d","dmy",true)> 0,"999","111") = '999' and [date_of_test_hiv] <>'' and [date_of_hiv_1_diag]


What I don't understand is the " < 0, "999", "111" " part?

What does it mean with regards the whole equation?

Thanks!

Reply all
Reply to author
Forward
0 new messages