If it's just Street that could be empty on the concatenated string use a StringReplacer with Text to find
STREET:,
replacing with nothing
Hi,
here is a simple Python script that will concatenate an arbitrary list of attributes, ignoring empty attribute values (NULL or empty string).
-----
import fmeobjects def FeatureProcessor(feature): to_concatenate = ("CITY", "STREET", "BLD_NUMBER") # Modify as needed join_string = "," # Modify as needed result = join_string.join(sfeature.getAttribute(attr) \\ for attr in to_concatenate if feature.getAttribute(attr)]) feature.setAttribute("CONCATENATED", result)
-----
Modify the variable "to_concatenate" so that it contains the names of all the attributes to join (case sensitive!) and modify "join_string" to whatever delimiter you desire, either a single character or a string.
For the PythonCaller, add "CONCATENATED" to the parameter "Attributes to expose".
Sample results:
`CONCATENATED' has value `Albany,17'
`CONCATENATED' has value `New-York,42 street,150'
David
Table with cities just for example. Real tables contain 3-30 different fields. Specify each field in each table it's kinda boring. And concatenated string must contain name of each field and their values.
I like idea with NullAttributeRemover, but i don't know how to insert in string field's name constant of attribute that can be or not after NullAttributeRemover.
Maybe here possible use an user parameter which contain all attributes of feature or something like this. I am new one to FME and not sure about it.
Anyway, thanks for answers.