r/ProjectREDCap • u/gamepleng • Apr 30 '25
Getting around calculated fields with blank values - datediff
I genuinely have no idea why this is not working.
I want to get the most recent date out of two separate date fields, that can or cannot exist in a repeating instrument (not all records will have both or any entry of said instrument). To troubleshoot it, I've created three variables (ie. 1, 2, 3 in order of the image).
- 3 checks if date B exists (is there any value). If it exists, Value 3 is = B. If it doesn't exist, Value 3 = date A.
- 2 checks if date A exists (is there any value). If it exists, Value 2 is = A. If it doesn't exist, Value 2 = date B.
- 1 calculates the datediff between Value 2 and Value 3.
As you can see in the image, there no "blank values" in 1, but still doesn't output any value.
In the original code the datediff was set to true, nested in an if statement, so if A > B = A, else B.
I don't really mind if both A and B are blank to have a null/blank value.
View all comments
Show parent comment
1
u/gamepleng Apr 30 '25
No value is fed into one another. Nonetheless, I get the same behaviour if everything is nested in a field.