By default, applicants' race and ethnicity information is exported from Outcomes as a string. When importing data into another system, it may be beneficial to convert this into an export containing one response for each race and ethnicity. Using these JavaScript expressions, you can export the race/ethnicity data as follows:



You have two options when adding the JavaScript Code for this expression:
In either case, you'll have an Expression area to add your code and configure it as desired.
{
function isWhite() {
// This function will return True if the applicant has selected this option
// If the forms is complete but this is not selected, it will return False
// If the form is unanswered, it will return an empty string
if ((forms) &&
(forms.race_ethnicity) &&
(forms.race_ethnicity.race) &&
(forms.race_ethnicity.race.length > 0)) {
let raceArray = forms.race_ethnicity.race;
let findRace = raceArray.find(raceOption => raceOption == "White");
return findRace ? true : false;
} else {
return "";
}
}
return isWhite();
}
{
function isAmIndian() {
// This function will return True if the applicant has selected this option
// If the forms is complete but this is not selected, it will return False
// If the form is unanswered, it will return an empty string
if ((forms) &&
(forms.race_ethnicity) &&
(forms.race_ethnicity.race) &&
(forms.race_ethnicity.race.length > 0)) {
let raceArray = forms.race_ethnicity.race;
let findRace = raceArray.find(raceOption => raceOption == "American Indian or Alaska Native");
return findRace ? true : false;
} else {
return
}
}
return isAmIndian();
}
{
function isAsian() {
// This function will return True if the applicant has selected this option
// If the forms is complete but this is not selected, it will return False
// If the form is unanswered, it will return an empty string
if ((forms) &&
(forms.race_ethnicity) &&
(forms.race_ethnicity.race) &&
(forms.race_ethnicity.race.length > 0)) {
let raceArray = forms.race_ethnicity.race;
let findRace = raceArray.find(raceOption => raceOption == "Asian");
return findRace ? true : false;
} else {
return "";
}
}
return isAsian();
}
{
function isBlack() {
// This function will return True if the applicant has selected this option
// If the forms is complete but this is not selected, it will return False
// If the form is unanswered, it will return an empty string
if ((forms) &&
(forms.race_ethnicity) &&
(forms.race_ethnicity.race) &&
(forms.race_ethnicity.race.length > 0)) {
let raceArray = forms.race_ethnicity.race;
let findRace = raceArray.find(raceOption => raceOption == "Black or African-American");
return findRace ? true : false;
} else {
return "";
}
}
return isBlack();
}
{
function isPacIslander() {
// This function will return True if the applicant has selected this option
// If the forms is complete but this is not selected, it will return False
// If the form is unanswered, it will return an empty string
if ((forms) &&
(forms.race_ethnicity) &&
(forms.race_ethnicity.race) &&
(forms.race_ethnicity.race.length > 0)) {
let raceArray = forms.race_ethnicity.race;
let findRace = raceArray.find(raceOption => raceOption == "Native Hawaiian or Other Pacific Islander");
return findRace ? true : false;
} else {
return "";
}
}
return isPacIslander();
}
{
function isHispanic() {
// This function will return True if the applicant has selected this option
// If the forms is complete but this is not selected, it will return False
// If the form is unanswered, it will return an empty string
if ((forms) &&
(forms.race_ethnicity) &&
(forms.race_ethnicity.hispanic) &&
(forms.race_ethnicity.hispanic != null)) {
return forms.race_ethnicity.hispanic == "Yes" ? true : false;
} else {
return "";
}
}
return isHispanic();
}
Several of the categories listed above have accompanying subcategories. Use the code below to produce a true or false for each of the possible subcategories.
{
// User Input Required
// Please select a valid subcategory from the field dictionary
// forms.race_ethnicity.asian_sub
let asianSubCat = "Cambodian";
/** Do Not Edit Below **/
function ethnicityAsian(asianSubCat) {
if ((forms) &&
(forms.race_ethnicity) &&
(forms.race_ethnicity.asian_sub) &&
(forms.race_ethnicity.asian_sub.length > 0)) {
let path = forms.race_ethnicity.asian_sub;
var asianSubIndex = path.indexOf(asianSubCat);
return path[asianSubIndex] == asianSubCat ? true : false;
} else {
return "";
}
}
return ethnicityAsian(asianSubCat);
}
{
// User Input Required
// Please select a valid subcategory from the field dictionary
// forms.race_ethnicity.hispanic_sub
let hispanicSubCat = "Cuban";
/** Do Not Edit Below **/
function ethnicityHispanic(hispanicSubCat) {
if ((forms) &&
(forms.race_ethnicity) &&
(forms.race_ethnicity.hispanic_sub) &&
(forms.race_ethnicity.hispanic_sub.length > 0)) {
let path = forms.race_ethnicity.hispanic_sub;
var hispanicSubIndex = path.indexOf(hispanicSubCat);
return path[hispanicSubIndex] == hispanicSubCat ? true : false;
} else {
return "";
}
}
return ethnicityHispanic(hispanicSubCat);
}
{
// User Input Required
// Please select a valid subcategory from the field dictionary
// forms.race_ethnicity.pac_island_sub
let pacIslandSubCat = "Samoan";
/** Do Not Edit Below **/
function ethnicityPacIsland(pacIslandSubCat) {
if ((forms) &&
(forms.race_ethnicity) &&
(forms.race_ethnicity.pac_island_sub) &&
(forms.race_ethnicity.pac_island_sub.length > 0)) {
let path = forms.race_ethnicity.pac_island_sub;
var pacIslandSubIndex = path.indexOf(pacIslandSubCat);
return path[pacIslandSubIndex] == pacIslandSubCat ? true : false;
} else {
return "";
}
}
return ethnicityPacIsland(pacIslandSubCat);
}
Lastly, if an applicant selects Other for their ethnicity's subcategory, they can type a response into an Other field. To build fields that display what the applicant entered, complete the following steps:
{
function otherAsianSubCat() {
// If there is a value for a write-in sub-category, the function will return that string
// If there is no value, it will return an empty string
if ((forms) &&
(forms.race_ethnicity) &&
(forms.race_ethnicity.other_asian_name) &&
(forms.race_ethnicity.other_asian_name != "") &&
(forms.race_ethnicity.other_asian_name != null)) {
return forms.race_ethnicity.other_asian_name ? forms.race_ethnicity.other_asian_name : "";
} else {
return "";
}
}
return otherAsianSubCat();
}
{
function otherHispanicSubCat() {
// If there is a value for a write-in sub-category, the function will return that string
// If there is no value, it will return an empty string
if ((forms) &&
(forms.race_ethnicity) &&
(forms.race_ethnicity.other_spanish_culture) &&
(forms.race_ethnicity.other_spanish_culture != "") &&
(forms.race_ethnicity.other_spanish_culture != null)) {
return forms.race_ethnicity.other_spanish_culture ? forms.race_ethnicity.other_spanish_culture : "";
} else {
return ""
}
}
return otherHispanicSubCat();
}
{
function otherPacIslandSubCat() {
// If there is a value for a write-in sub-category, the function will return that string
// If there is no value, it will return an empty string
if ((forms) &&
(forms.race_ethnicity) &&
(forms.race_ethnicity.other_pacific_islander_name) &&
(forms.race_ethnicity.other_pacific_islander_name != "") &&
(forms.race_ethnicity.other_pacific_islander_name != null)) {
return forms.race_ethnicity.other_pacific_islander_name ? forms.race_ethnicity.other_pacific_islander_name : "";
} else {
return ""
}
}
return otherPacIslandSubCat();
}
{
function tribeDetails() {
// If there is a value for a tribe, this function will return it's name
// Otherwise, this function will return an empty string
if ((forms) &&
(forms.race_ethnicity) &&
(forms.race_ethnicity.enrolled_tribe) &&
(forms.race_ethnicity.enrolled_tribe != "") &&
(forms.race_ethnicity.enrolled_tribe != null)) {
return forms.race_ethnicity.enrolled_tribe ? forms.race_ethnicity.enrolled_tribe : "";
} else {
return "";
}
}
return tribeDetails();
}
If you've added these JavaScript expressions as Custom Properties, you can use them in other areas:


