Table of Contents

Save datetime of field change

You can automatically capture the time of a field update by using a copy of the field on another form and a conditional date calculation. This information is automatically caputured in the audit log of REDCap, but is is not available in normal reports, skip logic, or other locations that a variable can be used.

If you want to track time of change on multiple variables, each must have its own pair of variables, one a copy of the original value and the other the time of change.

This page will use the example of [first_name] and track the changes to that variable. You can adjust variable names to match your use case.

Copy the current value of variable

Variable Name

[first_name_copy]

This variable records a copy of the variable we want to track changes on. It must exist on a different form than [first_name]. This ensures is it not updated until there is a save event on the server side.

Required action tags

@CALCTEXT([first_name])

What this does

Capture change time

Variable Name

[first_name_change_dt]

This variable captures the time of the value change and needs to be of type date. It will update twice, once when the value on the form is modified and again when that modified value is saved on the server. The calculation relies on the the difference between the current value of name and the copy,

Calculation

@CALCDATE(if([first_name] != [first_name_copy], 'now', [first_name_change_dt]), 0, 'd')

What this does

Note

It is suggest that the copy and time of change variables be tagged with @HIDDEN. It is likely that the content is not needed by data entry individuals and may lead to confusion.

Result

With both variables in place: