I had some trouble when inserting values from an exploded array into a multiple field. Everything looked fine but only the first item of the list was reflected in a ticked checkbox when editing the entity - on investigation in the DB, all the values after the first were added with a preceding space.
The string I was exploding was days of the week formatted like this:
monday, tuesday, wednesday, thursday...
I tried making the seperator value ", " (with a space), and it worked, but I felt that is not a good solution with maintainability in mind and is not likely to be robust.
In the end I came up with a patch which adds a checkbox to the action options, this trims whitespace from each array item.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | rules_data_transforms-add-trim-option-to-explode-2125835-2.patch | 1.22 KB | mjcarter |
| #1 | rules_data_transforms-add-trim-option-to-explode-2125835-1.patch | 1.17 KB | mjcarter |
Comments
Comment #1
mjcarter commentedComment #2
mjcarter commentedWhoops, spotted a schoolboy error when looking at the .patch file after uploading, now unticking the box works... I made the new option enabled by default as I believe it is less likely to lead to confusing behaviour - if others disagree please let me know.
I also fixed the white-spacing to be consistent with that currently used in the file.
Comment #3
mjcarter commented