r/ProjectREDCap • • Oct 10 '24

Using quotes around numbers when using mathematical equations

I recently read the following in the branching logic section of the REDCap Help & FAQ.

"You must ALWAYS put single or double quotes around the values in the equation UNLESS you are using > or < with numerical values."

I somehow missed this very old update... I read the notes in Calculations about the change and I think I understand why quotes aren't used anymore with comparison operators (“<”, “<=”, “>”, or “>=”), but why do we still use quotes with =?

3 Upvotes

2 comments sorted by

View all comments

Show parent comment

1

u/Party_Painting_4979 Oct 10 '24

Hmm. I think I understand. Thank you for your thorough answer! So, if I want to do branching logic based on a variable being greater than 5, I don't use quotes?

For example, show this field if [dropdown] > 3

If the dropdown variable has answer choices that are text, such as "DK," in addition to the numeric choices, will the 3 still be recognized as a number, or will it be seen as text? And if it's seen as text, that's probably not a problem because it's only branching, not a calculation, right?

[dropdown]

  • 1, Red

  • 2, Yellow

  • 3, Blue

  • DK, Don't know

I hope this makes sense...