Hi @Anonymous User ,
A simple fix could be this:
// create a disctionary with field names and month names (change the field names!)
var dct = {"OpenJan": "January", "OpenFeb": "February",
"OpenMar": "March", "OpenApr": "April",
"OpenMay": "May", "OpenJun": "June",
"OpenJul": "July", "OpenAug": "August",
"OpenSep": "September", "OpenOct": "October",
"OpenNov": "November", "OpenDec": "December"};
// simple fix, use a list of field names with the right order
var lst = ["OpenJan", "OpenFeb", "OpenMar", "OpenApr",
"OpenMay", "OpenJun", "OpenJul", "OpenAug",
"OpenSep", "OpenOct", "OpenNov", "OpenDec"];
// start with an empty result string
var result = "OK";
// start with an empty result string
var result = "";
// loop through the list of field names
for (var i in lst) {
var fldname = lst[i];
// read the value of the field
var fldval = $feature[fldname];
// validate if the value is YES
if (fldval == "YES") {
// add the month to the result
if (result == "") {
// first month
result = dct[fldname];
} else {
// any next month
result += ", " + dct[fldname];
}
}
}
return result;