So you want to use the Cloner to clone each feature 3 times?
Hi, the data i posted didnt display fully. Cloner was a suggestion i recived elsewhere however i fumbled around with python and manged to achieve what i was after
Effectively load multiple attributes into ONE attribute with a pipe seperator.
Counter to group common locations
Attribute splitter to create a list
List exploder
Then used randomgenerator for xy to to offset common locations
import fmeobjects # Template Function interface: def countZZ(feature): concat ="" VegCount = 0 for attr in feature.getAllAttributeNames(): tmpAttrVal = feature.getAttribute(attr) if (tmpAttrVal == 'x'): if (concat == ''): VegCount = 1 concat = attr else: VegCount += 1 concat = concat + "|" + attr feature.setAttribute("AllVeg", concat) feature.setAttribute("AllVegCount", VegCount)
Hi Brian,
Is this a second post - thought I had responed to your earlier question on the same problem but it seems to have vanished? Anyway here are some steps I think you need ...
Firstly, it is my understanding from your earlier post that there are (x) number species attributes and for each record only "some" of these are populated. The number populated changes from record to record, i.e. it is not always 3.
Secondly you only want to keep the attributes that are populated, i.e. for each point feature created, drop its NULL attributes.
- For each record species combination, enter a value of "1" in the cell (do this in Excel)
- Sum all the species attributes for each record - this will give you a species count (AttributeCreator)
- Using a cloner transformer set the number of copies to your sum value created in step 2 (Cloner)
- You now have one point per species type populated per record, but many of these points have NULL attributes which you need to drop - using an AttributeExploder create an attribute name/value pair for each attribute - created as _attr_name and attr_value (set Keep attributes = Yes)
- Identify all the NULL attributes by testing where _attr_value is NULL (Tester); for the data that passes the attribute _attr_name contains the name of an attribute that needs to be droppped
- The AttributeExploder will have changed the original table structure (exploded it) so now we should be able to return to the original format using an Aggregator transformer - setting GroupBy on OBJECT_ID and setting "Attributes to Concatenate = _attr_name" - this will now give us a "concatenated list" of NULL attribute names to be dropped
- Now pass attribute _attr_name (concatenated list) to a FMEFunctionCaller transformer and invoke the remove attributes function like this "@RemoveAttributes((@value(_attr_name)))"
This is untested but it makes sense in my head - give it a go :-)
Regards
Mike