Generalty i use ListConcatenator to concatenate ALL list items. I need to concatenate list items without the first item. Is there a specific transformer that can i use?
Thanks an advance.
FarFar
Generalty i use ListConcatenator to concatenate ALL list items. I need to concatenate list items without the first item. Is there a specific transformer that can i use?
Thanks an advance.
FarFar
I would apply Itay's 1st approach with a StringReplacer after concatenating.
Assume the separate character is a comma, the StringReplacer parameter settings are:
Attributes: _concatenated
Text to Find: ^n^,]*(,(.+))?$
ReplacementText: \\2
Use Regular Expressions: yes
If all elements of the list are not empty, there is the 3rd approach. That is, make the first element empty, then concatenate non-empty elements. AttributeCreator: _list{0} <-- <empty> ListConcatenator: Drop Empty Parts = Yes
Appendix:
A concise Python / Tcl script can concatenate list without the first element. PythonCaller
-----
import fmeobjects def concatenateListWithout1stElement(feature): delim = ',' src = feature.getAttribute('_list{}') feature.setAttribute('_concatenated', delim.join(srcd1:]) if src else '') -----
TclCaller
-----
proc concatenateListWithout1stElement {} { set delim {,} set elements {} for {set i 1} {nFME_AttributeExists "_list{$i}"] == 1} {incr i} { lappend elements }FME_GetAttribute "_list{$i}"] } return ijoin $elements $delim] }
-----
Takashi