letnextNotNullCondition=nextField+" is not null ";
if (doEmptyStringCheck||pAutoTrimFields)
nextNotNullCondition+=" and "+nextFieldTrimmed+" != '' ";
concatSql+="case when "+nextNotNullCondition+" then "+pSeparator+" else '' end "+concatCharacter;
}
}
}
_isNotEmpty=_isNotEmpty.bind(this);
for (leti=0;i<fields.length;i++){
if (retSql!="")
retSql+=concatSql;
retSql+="case when "+_isNotEmpty(fields[i])+" then ";
if (i<fields.length-1)//Prüfen, ob ein nachfolgender Wert kommt, sonst braucht man keinen Separator
retSql+=" case when "+_isNotEmpty(fields[i+1])+" then "+_trimIfAutoTrimEnabled(fields[i])+separatorSql+" else "+_trimIfAutoTrimEnabled(fields[i])+" end ";
else
retSql+=_trimIfAutoTrimEnabled(fields[i]);
//this blank is used just as in the old concat function which means this concat function has the same (wrong) behaviour
//TODO: find way to fix the case when separator is not a whitepsace (e.g. space)
//this concat-function does not work properly if you concat [<<value>>, <<null>>, <<value>>] by comma