Skip to main content
  • 10000+ Posts
  • 53,235 Replies
10000+ Posts
Set an attributevalue based of the occurence of a substring with the PythonCaller

Hi there I am trying to write a Python script which should change the value of an attribue based on the occurence of different substrings int the attribute. This is what i managed to create so far:import fmeimport fmeobjectsclass FeatureProcessor(object):    def __init__(self):        self.featureList = []            def input(self,feature):        self.featureList.append(feature)            def close(self):        substring1 = 'blabla'        for feature in self.featureList:            if  feature.getAttribute('TestAttribute') == substring1:                feature.setAttribute('TestAttribute', 'value1')            else:                feature.setAttribute('TestAttribute', 'value2')            self.pyoutput(feature)            This script can be executed but isn't doing the job right. Whith this script de Attribute valu

Badge Winners

  • Online Training
    zaaly216has earned the badge Online Training
  • Welcome Back
    gabrielmghas earned the badge Welcome Back
  • Welcome Back
    goldenakhas earned the badge Welcome Back
  • Online Training
    cforsdickhas earned the badge Online Training
  • Welcome Back
    wilmarhas earned the badge Welcome Back
Show all badges

Community Stats

32,413
Posts
122,925
Replies
40,132
Members

Latest FME