@@ -177,12 +177,13 @@ public Map<DatasetField, String> getDisplayValueMap() {
177177 if (StringUtils .isBlank (format )) {
178178 format = "#VALUE" ;
179179 }
180+
180181 String sanitizedValue = childDatasetField .getDatasetFieldType ().isSanitizeHtml () ? MarkupChecker .sanitizeBasicHTML (childDatasetField .getValue ()) : childDatasetField .getValue ();
181182 if (!childDatasetField .getDatasetFieldType ().isSanitizeHtml () && childDatasetField .getDatasetFieldType ().isEscapeOutputText ()){
182183 sanitizedValue = MarkupChecker .stripAllTags (sanitizedValue );
183184 }
184185 //if a series of child values is comma delimited we want to strip off the final entry's comma
185- if (format .equals ("#VALUE, " )) fixTrailingComma = true ;
186+ if (format .trim (). equals ("#VALUE," )) fixTrailingComma = true ;
186187
187188 // replace the special values in the format (note: we replace #VALUE last since we don't
188189 // want any issues if the value itself has #NAME in it)
@@ -247,9 +248,17 @@ private Map<DatasetField, String> removeLastComma(Map<DatasetField, String> mapI
247248 keyVal = entry .getKey ();
248249 oldValue = entry .getValue ();
249250 }
250-
251+
252+ String newValue = oldValue ;
253+
251254 if (keyVal != null && oldValue != null && oldValue .length () >= 2 ) {
252- String newValue = oldValue .substring (0 , oldValue .length () - 2 );
255+ //To take into account both versions of the tsv for display value
256+ if (oldValue .endsWith (", " )) {
257+ newValue = oldValue .substring (0 , oldValue .length () - 2 );
258+ } else if (oldValue .endsWith ("," )) {
259+ newValue = oldValue .substring (0 , oldValue .length () - 1 );
260+ }
261+
253262 mapIn .replace (keyVal , oldValue , newValue );
254263 }
255264
0 commit comments