Skip to main content
Question

Trouble with Custom Transformer and published parameters

  • June 3, 2021
  • 5 replies
  • 28 views

gpt_geoinfo
Contributor
Forum|alt.badge.img+2

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

gpt_geoinfo
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • 45 replies
  • June 3, 2021

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. 💁🏼‍♀️


canerakin
Contributor
Forum|alt.badge.img+6
  • Contributor
  • 51 replies
  • June 3, 2021

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


gpt_geoinfo
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • 45 replies
  • June 3, 2021

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. 😶


canerakin
Contributor
Forum|alt.badge.img+6
  • Contributor
  • 51 replies
  • June 3, 2021

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


gpt_geoinfo
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • 45 replies
  • June 4, 2021

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.