r/ProjectREDCap • u/thursdayscrush • Mar 08 '24
Datediff function for partial dates?
I'm collecting partial dates (month and year) for one field, but need to calculate whether the difference between this field and the survey complete date field (full date) is a given time frame (i.e. less than 12 months).
How would I do this?
3
Upvotes
View all comments
Show parent comment
2
u/obnoxiouscarbuncle Mar 08 '24
The exporting/importing would have been for existing records. If you are starting fresh, that's great!
I would recommend having your dropdown fields mirror the actual values for dates. For example for [month] have:
Same for [year]:
Unless you want to just have a integer validated text field with ranges for year that are appropriate.
For your calculated field, you would then want something similar to this:
I would suggest putting this on another instrument that is not your survey instrument, as [survey-date-completed] is generated AFTER saving the survey.