Skip to main content
  • 10000+ Posts
  • 53,366 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

  • FME Form Basic Training
    ft_asahas earned the badge FME Form Basic Training
  • Online Training
    96iamkaranhas earned the badge Online Training
  • Welcome Back
    mperryhas earned the badge Welcome Back
  • Welcome Back
    chrishas earned the badge Welcome Back
  • English Speaker
    jacksonbchas earned the badge English Speaker
Show all badges

Community Stats

32,418
Posts
123,204
Replies
40,531
Members