I wanna be able to define a global python function (perhaps in the startup scirpt?) like this:
def dosomething(number)
new_number = number + ... doing something with it
return new_number
then, en would like to reuse this global function many times at different moment in my workspace on many different attributes that has to go through the same treatment.
During the workflow of data_a, I'd call a pythoncaller this way:
newNumber = dosomething(feature.getAttribute('num_1'))
feature.setAttribute('num_1',newNumber)
newNumber = dosomething(feature.getAttribute('num_2'))
feature.setAttribute('num_2',newNumber)
During the workflow of data_b, I'd call a pythoncaller this way too:
newNumber = dosomething(feature.getAttribute('num_a'))
feature.setAttrivute('num_a',newNumber)
newNumber = dosomething(feature.getAttribute('num_b'))
feature.setAttrivute('num_b',newNumber)
I tried the same using a pythonCaller inside a customTransformer, but they both end up having to define all the attributes that they will have to deal with.
This way I have a extra layer of abstraction where my global python script "dosomething(number)" doesn't have to know the name of all the attributes that it receives.
Is that possible in FME?