Final fix over storing array of data from Datasets

This commit is contained in:
George Kalampokis 2021-06-14 18:01:04 +03:00
parent dcf88479bd
commit e615c403d3
2 changed files with 2 additions and 11 deletions

View File

@ -245,7 +245,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
StringBuilder valueBuilder = new StringBuilder();
valueBuilder.append("[");
for (int i = 0; i < valueCollection.size(); i++) {
valueBuilder.append(parseString(valueCollection.stream().toArray()[i]));
valueBuilder.append("\"").append(valueCollection.toArray()[i]).append("\"");
if (i < valueCollection.size() - 1) {
valueBuilder.append(", ");
}
@ -264,13 +264,4 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
public void toMap(Map<String, Object> fieldValues, int index) {
fieldValues.put(this.id, this.value);
}
private String parseString(Object value) {
if (value instanceof String) {
if (((String)value).contains(",")) {
return "\"" + value + "\"";
}
}
return value.toString();
}
}

View File

@ -107,7 +107,7 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
const originalValue = <string>this.form.get('value').value;
if (originalValue !== null && typeof originalValue === 'string') {
let values = (<string>this.form.get('value').value).slice(1, -1).split(', ').filter((value) => !value.includes('"'));
let specialValue = (<string>this.form.get('value').value).split('"').filter((value) => !value.startsWith('[') && !value.endsWith(']') && !values.includes(value));
let specialValue = (<string>this.form.get('value').value).split('"').filter((value) => !value.startsWith('[') && !value.endsWith(']') && !values.includes(value) && value !== ', ');
specialValue.forEach(value => values.push(value));
if (!originalValue.startsWith('[') && !originalValue.endsWith(']')) {
values = undefined;