How do I use quotation marks in REDCap conditional logic?
Quotation marks are used to reference the coded values of field choices (e.g. ‘1'=Yes or '0'=No) or data entered as text.
Example logic: [yes_no] = ‘1', [site] = ‘Cincinnati Children’s Hospital’
Note: Both single and double quotes will work within REDCap conditional logic as long as the pair is consistent. For example, [yes_no] = “1” is also valid logic but [yes_no] = '1” is not.
Quotation marks should not be used when referencing numerical values.
Example logic: [age] = 18, [height] > 160
These rules apply when writing logic utilizing special functions as well. For example:
left([local_id], 3) = ‘ABC’ uses quotes to compare the first 3 characters of the [local_id] to the text ‘ABC’
datediff([enrollment_date], 'today','d', true) = 14 does not use quotes because the datediff() function returns the number of days
More information on using using quotation marks in logic can be found in REDCap’s Help & FAQ, under the question “How should single and double quotes be used in calculations that involve comparison operators?”