Skip to content

Records Export

asaweero edited this page Aug 8, 2017 · 7 revisions

Export Records

Method Usage

var body = {
  type: 'flat'
}
records.exportRecords(body, function(err, res) {
  if (err) {
    // handle error
    return;
  }
  console.log(res); // res is an array of records
 }

Required Parameters

  • type: 'flat' to get all values for each record in one object, or 'eav' to get each field separately

Optional Parameters

  • records: an array of record IDs to pull. If omitted, all records will be pulled.
  • fields: an array of field names to pull. If omitted, all fields are pulled.
  • forms: an array of form names you wish to pull records for (spaces replaced with underscores). If omitted, all records are pulled.
  • events: an array of event names to pull records for (for longitudinal projects)
  • rawOrLabel: choose how to receive the options of multiple choice fields. Either 'raw' for raw coded values (default) or 'label' for labels
  • rawOrLabelHeaders: This is included as part of the REDCap API, but is currently unused by redcap.js as it pertains only to csv return types.
  • exportCheckboxLabel: If exporting in 'flat' format with labels, this determines the format of checkbox field values.
  • exportSurveyFields: Set to 'true' to export the survey identifier and survey timestamp fields, or 'false' (default) to not export them.
  • exportDataAccessGroups: Set to 'true' to export the 'redcap_data_access_group' field when data access groups are utilized in the project or 'false' (default) to not export. If the API key being used belongs to a data access group, this parameter is forced to 'false' regardless
  • filterLogic: A string of logic text that will filter the data to be exported. For example, [age] > 30 will only export records where the age field is greater than 30.