ITHS Tools
Connect with Us
Need Help? Have a Question?

REDCap Tip of the Month: New Sorting Functions

REDCap Tip of the Month: New Sorting Functions

The latest version of REDCap (i.e., version 6.0.0) overhauled a number of the features that allow you to aggregate, query, and export the data in your project.

This REDCap version also introduced a number of helpful functions that allow you to sort through unstructured data to create more dynamic reports. For example, you can now search or filter through all the email fields in your records for emails that end with “@gmail.com.”

New Sorting Functions

Function syntaxType of FunctionEffectsExample
contains (haystack, needle)
Does text CONTAIN another text string?
Returns a boolean (true or false) for if "needle" exists inside (is a substring of) the text string "haystack." Is case insensitive.
E.g. contains("Rob Taylor", "TAYLOR") will return as TRUE and contains("Rob Taylor", "paul") returns FALSE.
not_contain (haystack, needle)
Does text NOT CONTAIN another text string?
The opposite of contains(). Returns a boolean (true or false) for if "needle" DOES NOT exist inside (is a substring of) the text string "haystack." Is case insensitive.
E.g. not_contain("Rob Taylor", "TAYLOR") will return as FALSE and not_contain("Rob Taylor", "paul") returns TRUE.
starts_with (haystack, needle)
Does text START WITH another text string?
Returns a boolean (true or false) if the text string "haystack" begins with the text string "needle." Is case insensitive.
E.g. starts_with("Rob Taylor", "rob") will return as TRUE and starts_with("Rob Taylor", "Tay") returns FALSE.
ends_with (haystack, needle)
Does text END WITH another text string?
Returns a boolean (true or false) if the text string "haystack" ends with the text string "needle." Is case insensitive.
E.g. ends_with("Rob Taylor", "Lor") will return as TRUE and ends_with("Rob Taylor", "Tay") returns FALSE.

You can use these sorting functions to craft sophisticated reports to monitor the progression of your data collection in detail. The sorting functions also works in concert with normal branching logic functionality, meaning you can define even more specific logic in your forms.

See an overview of all functions

Please visit the REDCap home page to learn more about available training, support, and answers to common questions.

Preclinical Research Development

Are you thinking about human testing, but feel as though you first need to be able to better articulate viable commercialization, clinical, or regulatory strategies for your study? The ITHS Preclinical Research Development team helps researchers gain access to the expertise and tools needed to advance their innovative ideas.



Cite ITHSThe Institute is supported by grants UL1 TR002319, KL2 TR002317, and TL1 TR002318 from the NIH National Center for Advancing Translational Sciences through the Clinical and Translational Science Awards Program (CTSA).

Please help us continue to support your research by citing our grant number(s) in publications we supported.