Working …
This value you provided is not a number. Please try again.
This value you provided is not an integer. Please try again.
The value entered is not a valid Vanderbilt Medical Record Number (i.e. 4- to 9-digit number, excluding leading zeros). Please try again.
The value you provided must be within the suggested range
The value you provided is outside the suggested range
This value is admissible, but you may wish to double check it.
The value entered must be a time value in the following format HH:MM within the range 00:00-23:59 (e.g., 04:32 or 23:19).
This field must be a 5 or 9 digit U.S. ZIP Code (like 94043). Please re-enter it now.
This field must be a 10 digit U.S. phone number (like 415 555 1212). Please re-enter it now.
This field must be a valid email address (like joe@user.com). Please re-enter it now.
The value you provided could not be validated because it does not follow the expected format. Please try again.
Required format:
REDCap Logo
Plugins, Hooks, & External Modules
Developer methods for
Plugins, Hooks, & External Modules
Hook functions

REDCap Developer Tools:
Documentation for Plugins, Hooks, & External Modules

REDCap Version 14.9.1
REDCap::getEventIdFromUniqueEvent
(REDCap >= 6.4.0)
REDCap::getEventIdFromUniqueEvent — Returns the event_id associated with an event in a longitudinal project when given its associated unique event name
Description
int REDCap::getEventIdFromUniqueEvent ( string $unique_event_name )
Returns the event_id associated with an event in a longitudinal project when given its associated unique event name.
Parameters
unique_event_name
The unique name of the event, as provided on the project's Define My Events page.
Return Values
Returns the event_id number of the event. Returns FALSE if project is not longitidinal or if the unique event name is not valid.
Restrictions
This method can ONLY be used in a project context (i.e. when "pid" parameter is in the query string of the plugin URL) or else a fatal error is produced.
Examples
Example #1:
This example shows how to obtain the event_id for a given event using the unique event name, and then use the event_id to obtain a survey Participant List.
// Check if project is longitdudinal first
if (!REDCap::isLongitudinal()) exit("Cannot get event_id because this project is not longitudinal.");

// We have the unique event name and a unique instrument name for a survey
$unique_event = 'screening_arm_1';
$instrument = 'enrollment_survey';

// Get the event_id from the the unique event name
$event_id = REDCap::getEventIdFromUniqueEvent($unique_event);

// Now use the event_id and instrument name to fetch the survey's Participant List in CSV format
$participant_list_csv = REDCap::getParticipantList($instrument, $event_id);
REDCap 14.9.1 - © 2024 Vanderbilt University