Question

AttributeKeeper removes parameter values in custom transformer

  • 12 December 2022
  • 1 reply
  • 0 views

Badge +1

Hi,

 

Using an AttributeKeeper (or AttributeRemover) inside a custom transformer, I'm finding that it removes the value of any parameters that have been set using that attribute, is that the expected behaviour? (FME 2022.1 MacOS).

 

I would have expected a parameter set from an attribute value to hold the value of the attribute, but it seems to just be a reference to that attribute?

 

It's a bit odd as the parameter will have a value up to the point the attribute is removed, and after removing it the parameter will be empty. It can be quite tricky to track the issue down in a branching workflow too.

 

I've attached a sample workspace with a custom transformer to illustrate, but also a screen shot:

imageThanks,

Andy


1 reply

Badge +3

"I would have expected a parameter set from an attribute value to hold the value of the attribute, but it seems to just be a reference to that attribute?"

--> I believe your latter hypothesis is correct.

 

Probably the easiest way to deal with this is to use a ParameterFetcher at the start of your custom transformer.

Another workaround might be to add Python Scripted Parameters in your workspace that evaluate the original parameters (holding a reference to an incoming attribute), to a string value. However, that would mean to double the number of parameters.

 

ps1. You seem to have attached the log file of your sample workspace, and not the workspace itself.

ps2. Not sure if it already exists, but I would think that its worthy to file an idea to Safe to make sure parameters whose value are fed/entered through an attribute value (or another parameter, or even an arithmetic/text expression), are evaluated/dereferenced by default to a string/number value at the start of the custom transformer.

 

 

Reply