Adding options and export values to dropdown box.
I have a sheet where the number of fields is high but also variable project by project. I want to populate a dropdown with the fields to reduce the setup time for each new project.
Problem is I can't quite work out how set the export values as well. What I have so far:
function populateDD() {
var fieldList = [];
var exportMasks = [];
for (var i = 0; i < numFields; i++) { // loop for each field in form
if (-various statements to filter fields to the type I need for this list-){
exportMasks.push(this.getNthFieldName(i));
var maskString = this.getNthFieldName(i).replace(/_/g," ");
fieldList.push(exportString);
}
}
fieldList.sort();
exportMasks.sort();
this.getField(dropdownBoxInQuestion).setItems(fieldList, exportMasks);
}
I was hoping that would satisfy .setItems(option, export value) but it adds both arrays as options.