metafacture-core
metafacture-core copied to clipboard
Add a `join` function to Metamorph
It would be handy to have a simple join function which concatenates all data values it receives:
<data source="repeatedLiteral">
<join />
</data>
This statement should concatenate all repeatedLiteral values and emit the result at the end of the record.
The function should support the following parameters:
flushWith: when to emit the joined value (default value: record)reset: whether to reset after output (default value: true)delimiter: string to add between values (default value: empty string)
This can already be achieved using the <concat> collector:
<concat delimiter=';' name='concatenatedLiterals' flushWith='record'>
<data source='repeatedLiteral' />
</concat>
The join function would just be another way to do it. I would say it would be redundant.
Albeit, if there is a demand we could do this of course.
I just thought that a <join> function is more straight forward to understand when you simply want to join all occurrences of a field. It is also more concise than <concat>.