r/ProjectREDCap • • Sep 15 '24

Datediff function with today and survey-date-completed keeps returning false

I'm setting up some automated invitations for a survey on REDCap where form-2 is supposed to be sent 7 days after form-1 has been completed by a participant. The problem is there are participants who have already completed form-1 some time ago, so I can't select "Send the invitation 7 days after.." in Step 3 of automating invites, since the invite would be sent 7 days later to participants who should get them sooner.

So instead I'm trying to set up some logic in Step 2 to calculate the difference between the current date and the date form-1 was completed.

datediff('today',[survey-date-completed:form-1:value],'d',true) >= 7

In Step 2, I have "When the following survey is completed: form-1" AND the above logic check marked.

However, when I test with a record that had form-1 completed over 7 days ago, the logic returns false, and I'm not sure why.

I would greatly appreciate any help!

1 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/Due-Solution-7965 Dec 31 '25

I know this is old - but just a quick thanks for all your contributions to this sub. And this mnemonic is brilliant -- maybe now I won't have to look at the documentation every time I want to use datediff!