lib/impl/submissionExportHelper/csvHeaders.js
function generateFieldHeader(field, headerName, fieldRepeatIndex) {
  var csv = '';
  //If the field is repeating, the structure of the header is different
  if (_.isNumber(fieldRepeatIndex)) {
    //If it is a file type field, need to add two fields for the file name and url
    if (fieldTypeUtils.isFileType(field.type)) {
      csv += csvStr(headerName + '-' + (fieldRepeatIndex + 1) + "-name") + ",";
      csv += csvStr(headerName + '-' + (fieldRepeatIndex + 1) + "-url");
    } else if (fieldTypeUtils.isBarcodeType(field.type)) {
      //If it is a barcode type field, need to add two fields for the format name and text
      csv += csvStr(headerName + '-' + (fieldRepeatIndex + 1) + "-format") +
        ",";
      csv += csvStr(headerName + '-' + (fieldRepeatIndex + 1) + "-text");
    } else {
      //Otherwise, just append the index.
      csv += csvStr(headerName + '-' + (fieldRepeatIndex + 1));
    }
  } else {
    //If it is a file type field, need to add two fields for the file name and url
    if (fieldTypeUtils.isFileType(field.type)) {
      csv += csvStr(headerName + "-name") + ",";
      csv += csvStr(headerName + "-url");
    } else if (fieldTypeUtils.isBarcodeType(field.type)) {
      //If it is a barcode type field, need to add two fields for the format name and text
      csv += csvStr(headerName + "-format") + ",";
      csv += csvStr(headerName + "-text");
    } else {
      csv += csvStr(headerName);
    }
  }

  return csv;
}
function generateFieldHeader(field, headerName, fieldRepeatIndex) {
  var csv = '';
  //If the field is repeating, the structure of the header is different
  if (_.isNumber(fieldRepeatIndex)) {
    //If it is a file type field, need to add two fields for the file name and url
    if (fieldTypeUtils.isFileType(field.type)) {
      csv += csvStr(headerName + '-' + (fieldRepeatIndex + 1) + "-name") + ",";
      csv += csvStr(headerName + '-' + (fieldRepeatIndex + 1) + "-url");
    } else if (fieldTypeUtils.isBarcodeType(field.type)) {
      //If it is a barcode type field, need to add two fields for the format name and text
      csv += csvStr(headerName + '-' + (fieldRepeatIndex + 1) + "-format") +
        ",";
      csv += csvStr(headerName + '-' + (fieldRepeatIndex + 1) + "-text");
    } else {
      //Otherwise, just append the index.
      csv += csvStr(headerName + '-' + (fieldRepeatIndex + 1));
    }
  } else {
    //If it is a file type field, need to add two fields for the file name and url
    if (fieldTypeUtils.isFileType(field.type)) {
      csv += csvStr(headerName + "-name") + ",";
      csv += csvStr(headerName + "-url");
    } else if (fieldTypeUtils.isBarcodeType(field.type)) {
      //If it is a barcode type field, need to add two fields for the format name and text
      csv += csvStr(headerName + "-format") + ",";
      csv += csvStr(headerName + "-text");
    } else {
      csv += csvStr(headerName);
    }
  }

  return csv;
}
function generateFieldHeader ( field , headerName , fieldRepeatIndex ) { var csv = '' ; //If the field is repeating, the structure of the header is different if ( _ . isNumber ( fieldRepeatIndex ) ) { //If it is a file type field, need to add two fields for the file name and url if ( fieldTypeUtils . isFileType ( field . type ) ) { csv += csvStr ( headerName + '-' + ( fieldRepeatIndex + 1 ) + "-name" ) + "," ; csv += csvStr ( headerName + '-' + ( fieldRepeatIndex + 1 ) + "-url" ) ; } else if ( fieldTypeUtils . isBarcodeType ( field . type ) ) { //If it is a barcode type field, need to add two fields for the format name and text csv += csvStr ( headerName + '-' + ( fieldRepeatIndex + 1 ) + "-format" ) + "," ; csv += csvStr ( headerName + '-' + ( fieldRepeatIndex + 1 ) + "-text" ) ; } else { //Otherwise, just append the index. csv += csvStr ( headerName + '-' + ( fieldRepeatIndex + 1 ) ) ; } } else { //If it is a file type field, need to add two fields for the file name and url if ( fieldTypeUtils . isFileType ( field . type ) ) { csv += csvStr ( headerName + "-name" ) + "," ; csv += csvStr ( headerName + "-url" ) ; } else if ( fieldTypeUtils . isBarcodeType ( field . type ) ) { //If it is a barcode type field, need to add two fields for the format name and text csv += csvStr ( headerName + "-format" ) + "," ; csv += csvStr ( headerName + "-text" ) ; } else { csv += csvStr ( headerName ) ; } } return csv ; }
generateFieldHeader - Generating A single field header.

@param  {object} field            Field definition
@param  {string} headerName       Header Name to add
@param  {number} fieldRepeatIndex The index of a repeating field (null if it is not repeating)
@return {string}                  Generated CSV
generateFieldHeader - Generating A single field header .