REDCap Smart Variables

An introduction to Smart Variables

In REDCap Field Notation, variable names always point to data fields in the project. However, another type of entity exists called 'Smart Variables' that allow you to reference information other than data fields. Smart Variables are context-aware and thus adapt to many different situations in which they can know who the current user is, what event is currently being viewed, whether or not an instrument is being viewed as a survey or data entry form, etc. In this way, Smart Variables are dynamic (and thus 'smart') because they adapt to the current context in which they are used. Smart Variables are easily distinguishable from field variable names because Smart Variables will have dashes and colons whereas field variable names cannot.

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]

How and where to use Field Notation & Smart Variables

Field notation (whether referencing variable names or using Smart Variables) can be utilized in many places throughout REDCap. This makes it very powerful to use for a variety of purposes. Regardless of where it is utilized, the format of variable names in field notation is always the same. If a variable is used on its own, it will simply be [variable], and if you wish to specify that field variable for a specific event (for longitudinal projects), you must prepend the unique event name - e.g., [event][variable]. If you are referencing a specific repeating instance of the field, you append (not prepend) the repeat instance number in brackets - e.g., [variable][2], in which the format is the same for both repeating instruments and repeating events. If you are referencing the second instance of a repeating event, for example, you would use the format [event][variable][2]. If you are wanting to determine if a certain option for a checkbox field is checked or not, you may include the checkbox option value inside parentheses which follow the variable name inside the brackets - e.g., [my_checkbox(4)]. All these components can be used together, if needed, such as if you want to reference checkbox option 3 that exists on the fifth instance of a repeating instrument on 'Event 1' - e.g., [event_1_arm_1][my_checkbox(3)][5].

Field notation and Smart Variables can be used for...

  • Calculated fields - using mathematical operations to calculate a numerical result

  • Conditional logic - includes branching logic, advanced filters for reports, and logic for Survey Queue, Data Quality rules, Custom Record Status Dashboards, and Automated Survey Invitations

  • Piping - using field notation to insert values into labels on a survey/form or inside a survey invitation

NOTE: While Smart Variables can be utilized in Data Quality rule logic, in many cases they will cause Data Quality rules to take much longer to complete.

ADMINISTRATOR NOTE: Since you are a REDCap administrator, please be advised that you may also use Smart Variables inside the query of a dynamic SQL Field that is displayed on a survey or data entry form. You may see the SQL Field instructional popup in the Online Designer for tips on how to do this.

Smart Variable List

Listed below are all available Smart Variables, in which the description is given for each, along with an example of how it might be used. Please keep in mind that while Smart Variables can be used in calc fields, conditional logic, and piping, it does not mean that every Smart Variable should be used all of those places. For instance, you will likely only use [survey-link] and [form-url] for piping purposes. Also, [is-survey] and [next-event-name] will likely never make sense to be utilized in piping but instead in conditional logic (branching logic most likely). So remember that just because you *can* use Smart Variables in certain places does not necessarily mean that you *should*.

 

Name of Smart Variable

Description

Example of Usage

Example input

Example output

User

user-name

The current user's REDCap username.

[user-name]

jane_doe

user-fullname

The current user's first and last name (as listed on their Profile page).

[user-fullname]

Jane Doe

user-email

The current user's primary email address (as listed on their Profile page).

[user-email]

jane.doe@example.edu

user-dag-name

The Data Access Group (the unique group name) to which the current user belongs (blank if not in a DAG).

[user-dag-name]

vanderbilt_group

user-dag-id

The group ID number of the Data Access Group to which the current user belongs (blank if not in a DAG).

[user-dag-id]

324

user-dag-label

The name/label of the Data Access Group to which the current user belongs (blank if not in a DAG).

[user-dag-label]

Vanderbilt Group

user-role-id

The Role ID of the user role to which the current user is assigned (blank if not assigned to any user role). This value is auto-generated for each user role. NOTE: This value is not just unique for all roles within the project but is also unique across all REDCap projects. Thus, if the project and its user roles are copied, the Role IDs of the user roles in the resulting copy will be different from the ones in the original project.

[user-role-id]

127

user-role-name

The unique role name of the user role to which the current user is assigned (blank if not assigned to any user role). This value is auto-generated for each user role. NOTE: This value is only unique for roles within the project. Thus, if the project and its roles are copied, the new project will retain the same unique role names, which allows you to utilize the unique role names in conditional logic, calculations, branching logic, etc. that will not break when the project is copied.

[user-role-name]

U-699N7ET9KR

user-role-label

The name/label of the user role to which the current user is assigned (blank if not assigned to any user role). This value is defined by the user that creates the user role.

[user-role-label]

Data Entry Person

Record

calendar-link:Custom Text

The HTML web link that, when clicked, will navigate to the calendar feed or downloadable ICS calendar file belonging to the current record. 'Custom Text' is an optional parameter whereby you can specify the visible link text, and if it is not provided, it defaults to simply displaying the URL as the link text.

[calendar-link]

Download your calendar events (ICS file)

calendar-url

The web address (URL) of the calendar feed or downloadable ICS calendar file belonging to the current record.

[calendar-url]

https://redcap.wustl.edu/redcap/surveys/?__calendar=g2f2UkyPyYwn4sB3rvBZL2rhPpDssbWQXd39pz8s9nkIM2zX4RkgKwNrKMo4qQArvB5ibGDDqFyZs5ddEF7Efswn6cZ5J3pteRy3

record-dag-id

The group ID number of the Data Access Group to which the current record belongs (blank if not in a DAG).

[record-dag-id]

96

record-dag-label

The name/label of the Data Access Group to which the current record belongs (blank if not in a DAG).

[record-dag-label]

Harvard Site

record-dag-name

The Data Access Group (the unique group name) to which the current record belongs (blank if not in a DAG).

[record-dag-name]

harvard_site

record-name

The record name of the current record.

[record-name]

108

Form

is-form

Detects if the current instrument is being viewed as a data entry form (returns 1 for True, 0 for False), as opposed to a survey.

[is-form]

1

form-url:instrument

The web address (URL) of the specified data entry form for the current record/event/instance. The format must be [form-url:instrument], in which 'instrument' is the unique form name of the desired instrument.

[form-url:visit_data_form]

https://redcap.wustl.edu/redcap/redcap_v14.0.7/DataEntry/index.php?pid=example&event_id=example&id=example&instance=example&page=visit_data_form

[baseline_arm_1][form-url:visit_data_form]

https://redcap.wustl.edu/redcap/redcap_v14.0.7/DataEntry/index.php?pid=example&event_id=example&id=example&instance=example&page=visit_data_form

form-link:instrument:Custom Text

The HTML web link that, when clicked, will navigate to the specified data entry form for the current record/event/instance. The format must be [form-link:instrument] or [form-link:instrument:Custom Text], in which 'instrument' is the unique form name of the desired instrument. 'Custom Text' is an optional parameter whereby you can specify the visible link text, and if it is not provided, it defaults to the form label of the data entry form. The format [form-link:Custom Text] can also be used if the instrument is assumed, such as when viewing a form or in a survey invitation. Also, it can be used simply as [form-link] inside the content of a survey invitation, in which 'instrument' is assumed to be the current survey instrument.

[form-link:visit_data_form]

Visit Data Form

[next-event-name][form-link:visit_data_form]

Visit Data Form

[form-link:demography:Click here to view Demographics]

Click here to view Demographics

instrument-name

The unique instrument name of the current survey or data entry form. It will return a blank value if not in an instrument context.

[instrument-name]

demographics

[instrument-name]

prescreening_survey

instrument-label

The instrument label of the current survey or data entry form. It will return a blank value if not in an instrument context.

[instrument-label]

Demographics

[instrument-label]

Pre-Screening Survey

Survey

is-survey

Detects if the current instrument is being administered as a survey (returns 1 for True, 0 for False), as opposed to a form.

[is-survey]

0

survey-url:instrument

The web address (URL) of the specified survey for the current record/event/instance. The format must be [survey-url] or [survey-url:instrument], in which 'instrument' is the unique form name of the desired instrument. This can be used simply as [survey-url] inside the content of a survey invitation, in which 'instrument' is assumed to be the current survey instrument.

[survey-url:followup_survey]

https://redcap.wustl.edu/redcap/surveys/?s=fake

[previous-event-name][survey-url:followup_survey]

https://redcap.wustl.edu/redcap/surveys/?s=fake

survey-link:instrument:Custom Text

The HTML web link that, when clicked, will navigate to the specified survey for the current record/event/instance. The format must be [survey-link], [survey-link:instrument], or [survey-link:instrument:Custom Text], in which 'instrument' is the unique form name of the desired instrument. 'Custom Text' is an optional parameter whereby you can specify the visible link text, and if it is not provided, it defaults to the survey title of the survey. The format [survey-link:Custom Text] can also be used if the instrument is assumed, such as when viewing a form or in a survey invitation. Also, it can be used simply as [survey-link] inside the content of a survey invitation, in which 'instrument' is assumed to be the current survey instrument.

[survey-link:followup_survey]

Follow-up Survey

[next-event-name][survey-link:followup_survey]

Follow-up Survey

[survey-link:prescreening:Take the pre-screening survey]

Take the pre-screening survey

survey-access-code:instrument

The Survey Access Code of the specified survey for a given record/event/instance. The format must be [survey-access-code] or [survey-access-code:instrument], in which 'instrument' is the unique form name of the desired instrument. This can be used simply as [survey-access-code] inside the content of a survey invitation, in which 'instrument' is assumed to be the current survey instrument.

[survey-access-code:followup_survey]

LDNP3EW7W

[previous-event-name][survey-access-code:followup_survey]

DDFRLCTCR

survey-return-code:instrument

The Survey Return Code of the specified survey for a given record/event/instance in order to allow a participant to return to a completed or partially completed survey response when using the 'Save & Return Later' survey feature. The format must be [survey-return-code] or [survey-return-code:instrument], in which 'instrument' is the unique form name of the desired instrument. This can be used simply as [survey-return-code] inside the content of a survey invitation, in which 'instrument' is assumed to be the current survey instrument.

[survey-return-code:followup_survey]

TFX4E4YN

[previous-event-name][survey-return-code:followup_survey]

HEJNFHD4

survey-queue-url

The web address (URL) of the survey queue for the current record.

[survey-queue-url]

https://redcap.wustl.edu/redcap/surveys/?sq=fake

survey-queue-link:Custom Text

The HTML web link that, when clicked, will navigate to the survey queue for the current record. The format must be [survey-queue-link] or [survey-queue-link:Custom Text], in which 'Custom Text' is an optional parameter whereby you can specify the visible link text. And if it is not provided, it defaults to 'Survey Queue Link'.

[survey-queue-link]

Survey Queue Link

[survey-queue-link:View your survey progress]

View your survey progress

survey-title:instrument

The survey title of the instrument specified by the 'instrument' parameter (if provided). If the 'instrument' parameter is not provided, the current survey instrument will be used, else it will return a blank value if not in an instrument/survey context.

[survey-title]

Enter to Win a New Car

[survey-title:prescreening_survey]

Cardiology Study: Pre-Screening Survey

survey-time-started:instrument

The date and time on which the specified survey instrument was started for the current record/event (i.e., the initial time the survey page is opened). The format must be [survey-time-started:instrument], in which 'instrument' is the unique form name of the desired instrument. In a piping context, such as in a field label, survey invitation, or inside the @DEFAULT action tag, the format of the date and time will be displayed based on the current user's date/time display preferences. If you wish to have it return the raw value, which will instead be in 'YYYY-MM-DD HH:MM:SS' format and would be more appropriate for conditional logic or calculated fields, simply append ':value'. NOTE: If the start time is a blank value, it implies that the response began while on an earlier version of REDCap when start times were not yet collected.

[survey-time-started:followup]

12/25/2018 09:00am

[survey-time-started:followup:value]

2018-12-25 09:00:00

[survey-time-started:followup][last-instance]

12/25/2018 09:00am

[survey-time-started:followup:value][current-instance]

2018-12-25 09:00:00

survey-date-started:instrument

The date on which the specified survey instrument was started for the current record/event (includes date component only, unlike [survey-timestamp]). The format must be [survey-date-started:instrument], in which 'instrument' is the unique form name of the desired instrument. In a piping context, such as in a field label, survey invitation, or inside the @DEFAULT action tag, the format of the date will be displayed based on the current user's date display preferences. If you wish to have it return the raw value, which will instead be in 'YYYY-MM-DD' format and would be more appropriate for conditional logic or calculated fields, simply append ':value'. NOTE: If the start time is a blank value, it implies that the response began while on an earlier version of REDCap when start times were not yet collected.

[survey-date-started:prescreener]

12/25/2018

[survey-date-started:prescreener:value]

2018-12-25

[survey-date-started:prescreener][last-instance]

12/25/2018

[survey-date-started:prescreener:value][current-instance]

2018-12-25

survey-time-completed:instrument

The date and time on which the specified survey instrument was completed for the current record/event. The format must be [survey-time-completed:instrument], in which 'instrument' is the unique form name of the desired instrument. In a piping context, such as in a field label, survey invitation, or inside the @DEFAULT action tag, the format of the date and time will be displayed based on the current user's date/time display preferences. If you wish to have it return the raw value, which will instead be in 'YYYY-MM-DD HH:MM:SS' format and would be more appropriate for conditional logic or calculated fields, simply append ':value'. If the survey has not been completed, it returns a blank value.

[survey-time-completed:followup]

12/25/2018 09:00am

[survey-time-completed:followup:value]

2018-12-25 09:00:00

[survey-time-completed:followup][last-instance]

12/25/2018 09:00am

[survey-time-completed:followup:value][current-instance]

2018-12-25 09:00:00

survey-date-completed:instrument

The date on which the specified survey instrument was completed for the current record/event (includes date component only, unlike [survey-timestamp]). The format must be [survey-date-completed:instrument], in which 'instrument' is the unique form name of the desired instrument. In a piping context, such as in a field label, survey invitation, or inside the @DEFAULT action tag, the format of the date will be displayed based on the current user's date display preferences. If you wish to have it return the raw value, which will instead be in 'YYYY-MM-DD' format and would be more appropriate for conditional logic or calculated fields, simply append ':value'. If the survey has not been completed, it returns a blank value.

[survey-date-completed:prescreener]

12/25/2018

[survey-date-completed:prescreener:value]

2018-12-25

[survey-date-completed:prescreener][last-instance]

12/25/2018

[survey-date-completed:prescreener:value][current-instance]

2018-12-25

survey-duration:instrument:units

The amount of time that has elapsed since the survey was started (returned in the time units specified, defaults to 's'), and represents the difference between the survey's start time and either its 1) completion time (if completed) or 2) the current time (if not completed). Options for 'units': 'y' (years, 1 year = 365.2425 days), 'M' (months, 1 month = 30.44 days), 'd' (days), 'h' (hours), 'm' (minutes), 's' (seconds). Tip: The units value should not be wrapped in apostrophes or quotes. NOTE: If using [survey-duration] inside a calculated field or @CALCTEXT field, the value for partially completed surveys will always be changing until the survey is completed, and thus the value might not be accurate on reports or data exports unless you run Data Quality rule H immediately beforehand.

[survey-duration:prescreener]

845

[survey-duration:prescreener:h]

2.34

[visit_1_arm_1][survey-duration:prescreener][last-instance]

3829

survey-duration-completed:instrument:units

The total time it took to complete the survey (returned in the time units specified, defaults to 's'), and represents the difference between the survey's start time and completion time. NOTE: A blank value will be returned if the survey has not been completed. Options for 'units': 'y' (years, 1 year = 365.2425 days), 'M' (months, 1 month = 30.44 days), 'd' (days), 'h' (hours), 'm' (minutes), 's' (seconds). Tip: The units value should not be wrapped in apostrophes or quotes.

[survey-duration-completed:prescreener]

93

[survey-duration-completed:prescreener:m]

12.7

[visit_1_arm_1][survey-duration-completed:prescreener:d][last-instance]

3.89

Event & Arm

event-id

(longitudinal only) The event id number of the current event.

[event-id]

112

event-number

(longitudinal only) The current event's ordinal number as listed on the Define My Events page that denotes the order of the event within a given arm.

[event-number]

4

event-name

(longitudinal only) The current event (unique event name). Note: This can be used as stand-alone or can be prepended to a field variable.

[event-name]

event_2_arm_1

[event-name][weight]

125

event-label

(longitudinal only) The current event (the event label, not the unique event name).

[event-label]

Event 2

previous-event-name

(longitudinal only) The event (unique event name) that occurs immediately before the current event (blank if current event is the first event). Note: This can be used as stand-alone or can be prepended to a field variable. Important: When using this as a stand-alone variable, it will always return the event that occurs *immediately* before the current event, whereas if it is prepended to another variable, it will instead return the closest previous event for which the field's instrument has been designated, which might be different than the event that occurs directly before the current event. This behavior is due to the fact that the field's instrument might not always be designated for the event that occurs directly before the current event.

[previous-event-name]

visit_4_arm_2

[previous-event-name][heart_rate]

62

previous-event-label

(longitudinal only) The event (the event label, not the unique event name) that occurs immediately before the current event (blank if current event is the first event).

[previous-event-label]

Visit 4

next-event-name

(longitudinal only) The event (unique event name) that occurs immediately after the current event (blank if current event is the last event). Note: This can be used as stand-alone or can be prepended to a field variable. Important: When using this as a stand-alone variable, it will always return the event that occurs *immediately* after the current event, whereas if it is prepended to another variable, it will instead return the closest following event for which the field's instrument has been designated, which might be different than the event that occurs directly after the current event. This behavior is due to the fact that the field's instrument might not always be designated for the event that occurs directly after the current event.

[next-event-name]

event_3_arm_5

[next-event-name][provider]

Taylor

next-event-label

(longitudinal only) The event (the event label, not the unique event name) that occurs immediately after the current event (blank if current event is the last event).

[next-event-label]

Third Timepoint

first-event-name

(longitudinal only) The first event (unique event name) for the current arm. Note: This can be used as stand-alone or can be prepended to a field variable. Important: When using this as a stand-alone variable, it will always return the first event for the current arm, whereas if it is prepended to another variable, it will instead return the first event (for the current arm) for which the field's instrument has been designated, which might be different than the very first event. This behavior is due to the fact that the field's instrument might not always be designated for the very first event.

[first-event-name]

visit_1_arm_2

[first-event-name][heart_rate]

74

first-event-label

(longitudinal only) The first event (the event label, not the unique event name) for the current arm.

[first-event-label]

Visit 1

last-event-name

(longitudinal only) The last event (unique event name) for the current arm. Note: This can be used as stand-alone or can be prepended to a field variable. Important: When using this as a stand-alone variable, it will always return the last event for the current arm, whereas if it is prepended to another variable, it will instead return the last event (for the current arm) for which the field's instrument has been designated, which might be different than the very last event. This behavior is due to the fact that the field's instrument might not always be designated for the very last event.

[last-event-name]

week_22_arm_1

[last-event-name][provider]

Minor

last-event-label

(longitudinal only) The last event (the event label, not the unique event name) for the current arm.

[last-event-label]

Week 22

arm-number

(longitudinal only) The current arm number.

[arm-number]

2

arm-label

(longitudinal only) The arm label text of the current arm.

[arm-label]

Drug B

Repeating Instruments and Events

previous-instance

(repeating instruments/events only) The repeating instance number that occurs immediately before the current instance (e.g., current instance minus 1). 'Instance' refers to the instance of either a repeating instrument or a repeating event. Note: This can be used as stand-alone or can be appended to a field variable.

[previous-instance]

3

[weight][previous-instance]

145

current-instance

(repeating instruments/events only) The repeating instance number of a repeating instrument or a repeating event in the current context. Note: This can be used as stand-alone or can be appended to a field variable.

[current-instance]

2

[heart_rate][current-instance], which is the same as [heart_rate]

84

next-instance

(repeating instruments/events only) The repeating instance number that occurs immediately after the current instance (e.g., current instance plus 1). 'Instance' refers to the instance of either a repeating instrument or a repeating event. Note: This can be used as stand-alone or can be appended to a field variable.

[next-instance]

7

[provider][next-instance]

Harris

first-instance

(repeating instruments/events only) The first (lowest numbered) repeating instance number for the current record/event context. Note: This can be used as stand-alone or can be appended to a field variable.

[first-instance]

1

[age][first-instance]

24

last-instance

(repeating instruments/events only) The last (highest numbered) repeating instance number for the current record/event context. Note: This can be used as stand-alone or can be appended to a field variable.

[last-instance]

6

[glucose][last-instance]

119

new-instance

(repeating instruments/events only) A new, not-yet-created repeating instance for the current record/event context, in which [new-instance] is essentially [last-instance]+1. Note: This can be used as stand-alone or alternatively can be used by being appended to only the following Smart Variables: [survey-link], [survey-url], [survey-access-code], [form-link], and [form-url].

[new-instance]

14

[survey-link:repeating_survey:Repeating Survey][new-instance]

Repeating Survey

[survey-url:repeating_survey][new-instance]

https://redcap.wustl.edu/redcap/surveys/?s=fake&new

VIDEO: How to use Smart Charts, Functions, and Tables (14 min)

Aggregate Functions, Charts, and Tables
(also known as Smart Functions, Smart Charts, and Smart Tables)

aggregate-min:fields:parameters

The minimum value of a field across all records in the project (including all events and/or repeating instances in all records). Multiple fields may be used and must be comma-separated.

[aggregate-min:age]

13

[aggregate-min:age,participant_age,other_age]

7

aggregate-max:fields:parameters

The maximum value of a field across all records in the project (including all events and/or repeating instances in all records). Multiple fields may be used and must be comma-separated.

[aggregate-max:age]

95

aggregate-mean:fields:parameters

The mean/average value of a field across all records in the project (including all events and/or repeating instances in all records). Multiple fields may be used and must be comma-separated.

[aggregate-mean:age]

100.1

aggregate-median:fields:parameters

The median value of a field across all records in the project (including all events and/or repeating instances in all records). Multiple fields may be used and must be comma-separated.

[aggregate-median:age]

57

aggregate-sum:fields:parameters

The sum of all values for a field across all records in the project (including all events and/or repeating instances in all records). Multiple fields may be used and must be comma-separated.

[aggregate-sum:age]

9451

aggregate-count:fields:parameters

The count of all values for a field across all records in the project (including all events and/or repeating instances in all records). Multiple fields may be used and must be comma-separated.

[aggregate-count:age]

68

aggregate-stdev:fields:parameters

The standard deviation of a field across all records in the project (including all events and/or repeating instances in all records) Multiple fields may be used and must be comma-separated..

[aggregate-stdev:age]

5.4

aggregate-unique:fields:parameters

The count of unique values (i.e., a count that does not consider duplicate values) of a field across all records in the project (including all events and/or repeating instances in all records). Multiple fields may be used and must be comma-separated.

[aggregate-unique:age]

22

scatter-plot:x-axis-field, y-axis-field, grouping-field:parameters

Displays a scatter plot of one number/date/datetime field for the x-axis and a second field (number field only) for the y-axis. (If a second field is not provided, a random value will be assigned for the y-axis.) It can optionally perform color grouping if a third field (multiple choice only) is provided. All fields must be comma-separated. Note: When using multiple fields, data will be naturally grouped from the same event and/or repeating instance.

[scatter-plot:height]

[A chart displayed on the page]

[scatter-plot:height,weight]

[A chart displayed on the page]

[scatter-plot:height,weight,gender]

[A chart displayed on the page]

line-chart:x-axis-field, y-axis-field, grouping-field:parameters

Displays a line chart of one number/date/datetime field for the x-axis and a second field (number field only) for the y-axis. It can optionally perform color grouping if a third field (multiple choice only) is provided. All fields must be comma-separated. Note: A line chart is essentially the same as a scatter plot except with dots connected with a line. Note: When using multiple fields, data will be naturally grouped from the same event and/or repeating instance.

[line-chart:visit_date,weight]

[A chart displayed on the page]

[line-chart:visit_date,weight,gender]

[A chart displayed on the page]

bar-chart:field, grouping-field:parameters

Displays a bar chart for a single multiple choice field. It can optionally perform color grouping if a second field (multiple choice only) is provided. The fields must be comma-separated. Note: When using multiple fields, data will be naturally grouped from the same event and/or repeating instance.

[bar-chart:race]

[A chart displayed on the page]

[bar-chart:race,gender]

[A chart displayed on the page]

pie-chart:field:parameters

Displays a pie chart for a single multiple choice field.

[pie-chart:race]

[A chart displayed on the page]

donut-chart:field:parameters

Displays a donut chart for a single multiple choice field.Note: A donut chart is essentially the same as a pie chart but with the center removed.

[donut-chart:race]

[A chart displayed on the page]

stats-table:fields:columns:parameters

Displays a table of descriptive statistics for one or more fields (comma-separated) in which each field is represented as a row in the table. There is no limit to the number of fields that can be used. By default, all columns will be displayed and are as follows: Count, Missing, Unique, Min, Max, Mean, Median, StDev, Sum. To display only a subset of the columns, you may provide any of the following designations (comma-separated) that represent a specific column in the table: count, missing, unique, min, max, mean, median, stdev, sum.

[stats-table:age]

[A table displayed on the page]

[stats-table:age,weight,height]

[A table displayed on the page]

[stats-table:age,weight,height:min,max,median]

[A table displayed on the page]

Optional Parameters for Aggregate Functions, Charts, and Tables

_____:_____:R-XXXXXXXXXX

Unique Report Name - For Aggregate Functions, Charts, and Tables, filter the data being used by appending a Unique Report Name. Next to each report on the 'My Reports & Exports' page is its unique report name, which has 'R-' following by alphanumeric characters. By default, all Aggregate Functions, Charts, and Tables will use the values of all records in the project, but if a unique report name is appended to any of them, only data from that specific report will be used. Using a report as a surrogate to filter data is a very useful technique of performing complex filtering logic for Aggregate Functions, Charts, and Tables. IMPORTANT: When referencing a unique report name in Smart Charts, Smart Tables, or Smart Functions, no other filtering parameters can be used (e.g., DAGs, events) with the report filter. If you wish to additionally filter by DAGs and/or events, it is recommended that you added such filtering to the report itself by editing the report.

[aggregate-min:age:R-5898NNMYL4]

13

[pie-chart:race:R-2554F4TCNT]

22

[stats-table:height,weight,age:R-319PCCFN87]

[A table displayed on the page]

_____:_____:record-name

"record-name" - For Aggregate Functions, Charts, and Tables, filter the data being used to the *current record* by using the literal value 'record-name'. Note: This parameter will only work in a context where a single record is being viewed/accessed, such as on a survey page, data entry form, etc. This parameter can be used with any of the other parameters except unique report names.

[aggregate-max:weight:record-name]

95

[line-chart:height,weight:record-name]

[A chart displayed on the page]

_____:_____:event-name

"event-name" - For Aggregate Functions, Charts, and Tables, filter the data being used to the *current event* (longitudinal projects only) by using the literal value 'event-name'. Note: This parameter will only work in a context where a single record/event is being viewed/accessed, such as on a survey page, data entry form, etc. This parameter can be used with any of the other parameters except unique report names.

[aggregate-max:weight:event-name]

72

[line-chart:height,weight:event-name]

[A chart displayed on the page]

_____:_____:unique-event-names

Unique Event Names - For Aggregate Functions, Charts, and Tables, filter the data being used to specific events (longitudinal projects only) by providing an event's unique event name (found on the Define My Events page). You may use one or more unique event names (comma-separated). Note: This parameter can be used with any of the other parameters except unique report names.

[aggregate-min:weight:visit_1_arm_1]

19

[line-chart:height,weight:visit_1_arm_1,visit_1_arm_2]

[A chart displayed on the page]

_____:_____:user-dag-name

"user-dag-name" - For Aggregate Functions, Charts, and Tables, filter the data being used to the records assigned to the *current user's Data Access Group* by using the literal value 'user-dag-name'. Note: This parameter will only work in a context where an authenticated user belongs to a project and has been assigned to a DAG in the project (this excludes survey pages and public project dashboards). This parameter can be used with any of the other parameters except unique report names.

[aggregate-mean:weight:user-dag-name]

45.2

[line-chart:height,weight:user-dag-name]

[A chart displayed on the page]

_____:_____:unique-dag-names

Unique DAG Names - For Aggregate Functions, Charts, and Tables, filter the data being used to the records assigned to specific Data Access Groups by providing a DAG's unique group name (found on the Data Access Groups page). You may use one or more unique DAG names (comma-separated). Note: This parameter can be used with any of the other parameters except unique report names.

[aggregate-median:weight:vanderbilt_group]

36

[line-chart:height,weight:vanderbilt_group,duke_group,harvard_group]

[A chart displayed on the page]

_____:_____:bar-vertical

"bar-vertical" - Display a bar chart with the bars going vertically instead of horizontally (the default) by using the literal value 'bar-vertical'. Note: This parameter can be used with any of the other parameters.

[bar-chart:race:bar-vertical]

[A chart displayed on the page]

[bar-chart:race,gender:bar-vertical]

[A chart displayed on the page]

_____:_____:bar-stacked

"bar-stacked" - Only for bar charts using two fields, display the bar chart with the bars stacked on top of one another for each choice. Whereas the default view is that the bars of each field are displayed side by side to show the color grouping. To enable this, use the literal value 'bar-stacked'. Note: This parameter can be used with any of the other parameters.

[bar-chart:race,gender:bar-stacked]

[A chart displayed on the page]

[bar-chart:race,gender:bar-vertical,bar-stacked]

[A chart displayed on the page]

_____:_____:no-export-link

"no-export-link" - Only used for [stats-table], hides the "Export table (CSV)" link that by default is displayed immediately below the Smart Table.

[stats-table:age,race,gender:no-export-link]

[A chart displayed on the page]

MyCap

mycap-project-code

The MyCap project code of the current REDCap project.

[mycap-project-code]

P-5CLDRMQ28TSJJXD7KA1K

mycap-participant-code

The participant code of the current record.

[mycap-participant-code]

U-NEXAXSMQZ3YFTZDMMSEX

mycap-participant-url

The web address (URL) for the current record that can be used by the participant to join the project on the MyCap mobile app.

[mycap-participant-url]

https://mycap.link/join/?apn=org.vumc.victr.mycap&isi=1209842552&ibi=org.vumc.mycap&link=https%3A%2F%2Fmycap.link%2Fjoin.html%3Fpayload%3DeyJlbmRwb2ludCI6Imh0dHA6XC9cL2xvY2FscmVkY2FwOjgwODBcL1JlZGNhcFwvcmVkY2FwX3YxMS4xLjBcL0V4dGVybmFsTW9kdWxlc1wvP3ByZWZpeD1teWNhcCZwYWdlPXdlYiUyRmFwaSUyRmluZGV4IiwicHJvamVjdCI6IlAtNUNMRFJNUTI4VFNKSlhEN0tBMUsifQ%253D%253D%26participant%3DU-NEXAXSMQZ3YFTZDMMSEX

mycap-participant-link:Custom Text

The HTML web link belonging to the current record that, when clicked, will allow the participant to join the project on the MyCap mobile app. 'Custom Text' is an optional parameter whereby you can specify the visible link text, and if it is not provided, it defaults to simply displaying the URL as the link text.

[mycap-participant-link:Click this MyCap link]

Click this MyCap link

Miscellaneous

project-id

The Project ID (i.e., PID) of the current REDCap project.

[project-id]

39856

data-table

The name of the specific redcap_data* database table (located on the back-end REDCap database server) used by the current REDCap project. If a PID (project ID) is provided as a parameter (e.g., [data-table:435]), then the name of the redcap_data* table will be returned for that specific project/PID.

[data-table]

redcap_data3

[data-table:731]

redcap_data2

redcap-base-url

The base web address for this REDCap installation.

[redcap-base-url]

https://redcap.wustl.edu/redcap/

redcap-version

The current REDCap version number of this REDCap installation.

[redcap-version]

14.0.7

redcap-version-url

The base web address of the current REDCap version directory for this REDCap installation.

[redcap-version-url]

https://redcap.wustl.edu/redcap/redcap_v14.0.7/

survey-base-url

The base web address for surveys for this REDCap installation.

[survey-base-url]

https://redcap.wustl.edu/redcap/surveys/