Smart Variables are dynamic variables (from a predefined list of 35 that can be found below) that can be used in calculated fields, conditional/branching logic, and piping. Similar to using project variable names inside square brackets - e.g., [heart_rate], Smart Variables are also represented inside brackets - e.g., [user-name], [survey-link], [previous-event-name][weight], or [heart_rate][previous-instance]. But instead of pointing to data fields, Smart Variables are context-aware and thus adapt to the current situation. Some can be used with field variables or other Smart Variables, and some are meant to be used as stand-alone. There are many possibilities. Smart Variables can reference things with regard to users, records, forms, surveys, events/arms, or repeating instances.

Smart Variables can be used...
On their own - e.g., [record-dag-name]
In conjunction with field variables - e.g., [previous-event-name][weight_measurement]
In conjunction with other Smart Variables - e.g., [previous-event-name][survey-url:prescreening_survey]

Here is the current list of Smart Variables and the operations they cause in REDCap


An Example of is as Follows: 

A study would like to generate a study ID which pulls information from various record responses and REDCap system properties. In this example, we will pull in the following to auto create a study ID: 

Record ID: We will pull in the record ID with the smart variable [record-name]  

Participant Name: We will pull in the participant name with the default action tag and pipe in a traditional variable response 

Study ID: We will pull the study ID with a default action tag and pipe in a traditional variable response 

REDCap User Completing the form:  We will pull this with the smart variable [user-name] and the default action tag


The first step would be to create each field (if needed). The record ID and the REDCap User fields do not need to be created.  


Next we build a new variable, if we are piping in responses this variable will need to be in a new instrument. 

Variable creation will look like this: 


Use @default = 'and then put the variable names in brackets you would like insert into the answer, surrounded by parentheses' 

You'll notice the smart variables have use a dash (like: record-id) and the traditional variables use an underscore (like: study_ID).  

Here is how it will behave in a survey / data entry view


The Record ID is created by REDCap. Name is entered, the Study ID is entered, the User ID is record by REDCap but not visible. 

We then go to the next Form- The ID will auto generate and display  








  • No labels