Troubleshooting "Erase Current Value" Warnings associated with Calculated Fields in REDCap

When Calculated Fields in REDCap are hidden by Branching Logic, you may see the following error:

This warning appears because a value is still being calculated even though the field is hidden because its Branching Logic requirements have not been met. To remove this warning, the calculation must be updated to include if/then statements to hide the field unless Branching Logic is fulfilled.

Example

In this article, we will explore the logic needed to caluclate sum, for the equation below:

Sample Calculation: [sum] = [value_01] + [value_02]

Sample Branching logic for [sum]: [value_01] = 0

  1. Create the calculated field:

2. Add the Branching Logic:

3. Create a record, you will notice that when a value other than 0 is entered into [value_01] the following warning appears:

 

 Solution Instructions

  1. Edit the Calculated Value to include an if statement that accounts for cases where the calculated variable would be hidden because of its branching logic.

    1. Example: if([value_01]='0', [value_01]+ [value_02],'')

This states that:

  • if branching logic conditions for the calculated field are met ([value_01]='0’):

    • perform the calculation (add [value_01] and [value_02])

  • if branching logic conditions for the calculated field are not met:

    • return a null (““) value.

 

2. Return to your test record and confirm that the warning no longer appears.

Solution Summary: The calculation has been updated so that the calculated field will only return a value when the Branching Logic conditions are met and will return a null value so the field can be hidden when Branching Logic conditions are not met.

Alternately, you may add the following logic to the calculated value in order to remove the warning: [this_field]<>””