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::getExportFieldNames
(REDCap >= 6.4.0)
REDCap::getExportFieldNames — Returns a list of the export/import-specific version of field names for all fields (or for one field, if desired) in the current project
Description
array REDCap::getExportFieldNames ( [ string $field_name = NULL ] )
Returns a list of the export/import-specific version of field names for all fields (or for one field) in the current project. This is mostly used for checkbox fields because during data exports and data imports, checkbox fields have a different variable name used than the exact one defined for them in the Online Designer and Data Dictionary, in which *each checkbox option* gets represented as its own export field name in the following format: field_name + triple underscore + converted coded value for the choice. For non-checkbox fields, the export field name will be exactly the same as the original field name. Note: The following field types will be automatically removed from the list returned by this method since they cannot be utilized during the data import process: "file" and "descriptive".
Parameters
field_name
A field's variable name. By default, NULL is used. If field_name is provided, then it will return an array of only the export field name(s) for that field, but if the field name is invalid, it will return FALSE.
Return Values
By default, returns an array of the export-specific version of field names for all fields in the project. If the field_name parameter is provided, then it will return an array of the export field names for just that field. In the array returned, the array keys will be the original field name (variable). For non-checkbox fields, the corresponding value for each array element will also be the original field name (i.e., the key and value will be the same). But for checkbox fields, the corresponding array value will itself be a sub-array of all choices for the checkbox, in which each key of the sub-array is the raw coded value of the choice with its associated value being the export field name for that choice.
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 all the export field names for all fields in the project.
// Get an array of all the export field names for all fields in the project
$all_export_field_names = REDCap::getExportFieldNames();
Example #2:
This example shows how to obtain all the export field names for a checkbox field named "medications_checkbox".
// Set the variable name of our checkbox field
$checkbox_field = "medications_checkbox";

// Get an array of all the export field names for our checkbox field
$medications_export_field_names = REDCap::getExportFieldNames($checkbox_field);
REDCap 14.9.1 - © 2024 Vanderbilt University