Action Tags
Action tags are special features that begin with the '@' sign that can be placed inside a field's Field
Annotation. Each action tag has a corresponding action that is performed for the field when displayed
on data entry forms and survey pages.
A full list of the action tags that can be used in REDCap:
Action Tag
Function
@CALCDATE
Performs a date calculation by adding or subtracting a specified amount of time
from a specified date or datetime field and then provides the result as a date or
datetime value - e.g., @CALCDATE([visit_date], 7, 'd'). The first parameter inside
the @CALCDATE() function should be a text field with date, datetime, or
datetime_seconds validation, in which you may specify (if needed) the event and
repeating instance - e.g., @CALCDATE([baseline_event][visit_date], 7, 'd'). The
second parameter represents the offset number amount that should be added
or subtracted. It can be a decimal number or integer. Tip: To subtract (i.e., go
backwards in time), use a negative number. The third parameter represents the
units of the offset amount, which will be represented by the following options:
'y' (years, 1 year = 365.2425 days), 'M' (months, 1 month = 30.44 days), 'd'
(days), 'h' (hours), 'm' (minutes), 's' (seconds). The unit option must be wrapped
in quotes or apostrophes. NOTE: Both the source field and the result field must
be a text field with date, datetime, or datetime_seconds validation. It is
important to realize that a field with @CALCDATE will not be editable on the
survey page or data entry form, and the field will function almost exactly like a
normal calculated field, in which its value may get updated via a data import,
when running Data Quality rule H, or in real-time during normal data entry on a
form or survey.
@CALCTEXT
Evaluates logic that is provided inside a @CALCTEXT() function and outputs the
result as text, typically performed with an if(x,y,z) function - e.g.,
@CALCTEXT(if([gender]='1', 'male', 'female')). NOTE: It is important to realize
that a field with @CALCTEXT will not be editable on the survey page or data
entry form, and the field will function almost exactly like a normal calculated
field, in which its value may get updated via a data import, when running Data
Quality rule H, or in real-time during normal data entry on a form or survey. If
desired, it is possible to return the value as a number - e.g., @CALCTEXT(if([age]
>= 18, 'adult', 5*[other_field])). Also, while it is possible to use static text (in
quotes), field variables, or Smart Variables as the return values of the IF function
- e.g., @CALCTEXT(if([age] >= 18, [dob], [event-label]) - it is NOT possible to pipe
field variables or Smart Variables inside quotes for the return values.
@CHARLIMIT
Limits the number of characters in a field
@DEFAULT
Sets a field's initial value. This allows a field to have a specified default value
when viewing the field on a survey or data entry form that has not yet had any
data saved for it. For text fields, you may even perform Piping inside the default
value to pipe data from another field in the project.
@HIDDEN
Hides the field on both the survey page and the data entry form.
@HIDDEN-FORM
Hides the field only on the data entry form
@HIDDEN-PDF
Hides the field on the PDF export
@HIDDEN-SURVEY
Hides the field only on the survey page
@HIDEBUTTON
Hides the 'Now' or 'Today' button that is typically displayed to the right of date,
time, and date/time fields.
@HIDECHOICE
Allows the user to "retire" an answer choice and hide it without losing data
@INLINE
Allows a PDF file or image file (JPG, JPEG, GIF, PNG, TIF, BMP) that is uploaded to
a File Upload field to be displayed in an inline manner on the survey page or data
entry form so that the PDF/image can be viewed by the user or survey
participant without having to download it. The PDF/image will be displayed
inline on the page immediately above the download link for the field and will be
displayed with 100% width by default (i.e., 100% width of the area in which it is
contained). Images will be displayed with their native width:height ratio,
although PDFs will be displayed with a 300 pixel height by default. If you wish to
manually set the width and/or height of the image/PDF, you may put the
width/height values inside parentheses after the action tag in the following
manner: @INLINE(width) or @INLINE(width,height). The width/height can be a
percentage value (e.g., 50%) or a number representing size in pixels (e.g., 400).
Thus @INLINE(50%) will display an image at 50% size for the area in which it is
contained on the page, and @INLINE(400,100) would display the image always at
400px tall and 100px wide. To make an inline PDF appear taller on the page, you
might use @INLINE(100%,600) since 300px is the default height for inline PDFs.
Note: The @INLINE action tag also works if the File Upload field is embedded
inside another field on the page.
@LATITUDE
Allows text field to capture latitude of user
@LONGITUDE
Allows text field to capture longitude of user
@MAXCHECKED
Allows designer to limit the number of answer choices a participant can check
@MAXCHOICE
Limits the number of people who can select each answer choice
@NOMISSING
Disable 'missing data codes' for a field - If custom codes for specifying missing
data have been set up in this project (in the Additional Customizations popup on
the Project Setup page), this action tag will disable the missing data code
functionality for a given field, thus hiding the 'M' icon next to the field.
@NONEOFTHEABOVE
A none of the above feature for checkbox fields that prevent the data enterer
from selecting multiple options
@NOW
Automatically provides the user's current time as value of a text field when page
is loaded
@NOW-SERVER
Loads the REDCap server's date+time into a blank text field when the page loads
@NOW-UTC
Loads the UTC date+time into a blank text field when the page loads
@PASSWORDMASK
Masks the value of a text field so that the rue value is not visible on the webpage
after it has been entered
@PLACEHOLDER
Is used to specify a short hint that describes the expected value of a Text field or
Notes field
@RANDOMORDER
Randomizes the order of answers in multiple choice questions
@READONLY
Makes the field read-only on both the survey page and the data entry form
@READONLY-FORM
Makes the field read-only on the data entry form
@READONLY-SURVEY
Makes the field read-only on the survey
@SETVALUE
Sets a field's value to static text or dynamic/piped text whenever a data entry
form or survey page is loaded, in which it will always overwrite an existing value
of the field. The format must follow the pattern @SETVALUE="????", in which
the desired value should be inside single or double quotes. For text fields, you
may pipe and concatenate values from other fields in the project - e.g.,
@SETVALUE='Name: [first_name] [last_name], DOB: [dob]'. For checkbox fields,
simply separate multiple checkbox values with commas - e.g.,
@SETVALUE='1,3,[other_field:value]'. NOTE: The piped value does *not* get
applied during any data imports (via API or Data Import Tool) but only operates
when viewing survey pages and data entry forms. NOTE: A field with
@SETVALUE will have its value updated ONLY when the page loads, which means
that its value will not be updated in real-time if you modify other fields on the
same page that are piped into the @SETVALUE tag. NOTE: If being used on a
date or datetime field, the date value inside the quotes must be in Y-M-D format
- e.g., @SETVALUE='2007-12-25' - regardless of the field's set date format. NOTE:
The only difference between @SETVALUE and @DEFAULT is that @DEFAULT is
only applied when an instrument has no data yet, whereas @SETVALUE will
always be applied on an instrument, meaning that @SETVALUE will ALWAYS
overwrite the value if a field value already exists. TIP: To pipe the value of one
multiple choice field into another multiple choice field, make sure you append
':value' to the variable being piped - e.g., @SETVALUE='[my_dropdown:value]'.
(In earlier versions of REDCap, the @SETVALUE action tag went by the name
@PREFILL, which still works equivalently to @SETVALUE for backward
compatibility purposes.)
@TODAY
Automatically provides the user's current date as value of a text field when page
is loaded
@TODAY-SERVER
Loads the REDCap server's date into a blank text field when the page loads
@TODAY-UTC
Loads the UTC date into a blank text field when the page loads
@USERNAME
Sets a field's value to the username of the current REDCap user. If this is used on
a survey, the value will be '[survey respondent]'. Once the value is captured, it
will not be changed when visiting the page at a later time.
@WORDLIMIT
Limits the number of words in a field
There are three additional action tags for the REDCap App. They are:
Action Tag
Function
@BARCODE-APP
Allows the REDCap mobile App to capture the value of a barcode or QR code
@HIDDEN-APP
Hides the field only on the form ONLY on the REDCap mobile app
@READONLY-APP
Makes the field read-only on the form ONLY on the REDCap Mobile App
@APPUSERNAME-
APP
Sets a field's value to the app username of the current mobile app user
@SYNC-APP
For File Upload and Signature fields. This will cause any image files uploaded to a
record to be sent to the app so that they are viewable in the app when editing the
record.