Question

Trouble with Custom Transformer and published parameters


Badge +1

Hey Y'all,

I'm having troubles with creating a custom transformer and its published parameters. The goal is to add a number (calculated with SQL and a chosen leading number) to different (existing) numbers. These numbers are stored in different attribute names, i.e. id, type. When I create a custom transformer with the 'id' and want to use it with the attribute 'type' it keeps calculating the 'id' OR if I edit the parameter I can't choose it from an attribute anymore. I'm stuck!

A sample workspace is attached (FME 2021).

Any ideas appreciated.

Cheers,

Maria


5 replies

Badge +1

Or in short: How can I just increase a passed attribute (integer) with a desired number in a custom transformer? I always fail with passing the attribute. 💁🏼‍♀️

Badge +4

You can use loop to an iterate the attribute certain amount of time so it would increase the attribute or just use pythonCaller with a loop. There is an example in the link below, take a look.

https://safe-software.gitbooks.io/fme-desktop-advanced-training-2018/content/DesktopAdvanced5CustomTransformers/5.11.CustomTransformerLoops.html

Badge +1

No, I don't need a loop. I just want to add a number.

 

In the meantime I tried to use the PythonCaller. It works quite good. But when I use the custom transformer twice in a row (as I want to add the number to two different attributes) it doesn't work. The first attribute gets the double addition. 😶

Badge +4

I really want to help but your question is not clear for me. Can you provide an example of input data and output data?

Badge +1

Well, I already did, but might not be specific enough.

I cannot provide the original data. So I tried to minimize the problem and used some dummy transformers.

So here is an example workspace with and without custom transformer.

Reply