metafacture-core icon indicating copy to clipboard operation
metafacture-core copied to clipboard

Add a `join` function to Metamorph

Open cboehme opened this issue 11 years ago • 2 comments

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)

cboehme avatar Dec 10 '14 10:12 cboehme

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.

dr0i avatar Oct 25 '19 08:10 dr0i

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>.

cboehme avatar Nov 03 '19 17:11 cboehme