Are you just removing columns and creating new ones so 10 records in and 10 out, or creating more or less records, so 10 records in and 5 out?
It's more record coming in and less record going out
This is when you use the self to store that values you want to create in the close section as the init / self values are global variables.
The code below is the same as a group by with a sum total of the value
import fmeobjects
import fme
class FeatureProcessor(object):
def __init__(self):
# create my store of values
self.featureStore = {}
def input(self,feature):
Group = feature.getAttribute("ColA")
Value = feature.getAttribute("ColB")
# if the value exists in the store then add the value otherwise create a new value in the store
try:
CurrentValue = self.featureStoreiGroup]
self.featureStore except KeyError:
self.featureStorepGroup] = CurrentVal
def close(self):
# loop through the store and create the new features
for group, value in self.featureStore.items():
newFeature = fmeobjects.FMEFeature()
newFeature.setAttribute("NewColA", group)
newFeature.setAttribute("NewColB", value )
self.pyoutput(newFeature)
Also remember you will need to show and hide the correct attributes.