What can I do to expose attributes on only the Transformer Input for which they pertain?
I am more concerned with keeping the inbound attributes straight per feature pipeline, than using published parameters. Thanks!
What can I do to expose attributes on only the Transformer Input for which they pertain?
I am more concerned with keeping the inbound attributes straight per feature pipeline, than using published parameters. Thanks!
If you once expose attributes by checking on their names in the Input port properties dialog (External Attributes to Expose), Published Parameters and internal attributes corresponding to them will be created. At run-time, the custom transformer will receive values through the parameters, and store the values into the internal attributes.
Although the internal attribute names will be the same as the external attribute names at the time when you exposed them, this doesn't mean that the external attributes will be refered directly in the custom transformer. The internal attributes will store values received through the Published Parameters always. Therefore, you don't need to modify them when you use the transformer in the different contexts. You can pass required values to the internal attributes through the parameters anywhere.
If you don't want to use the external attribute names in the custom transformer, you can also define Published Parameters manually and fetch their values inside of the custom transformer. In fact, this had been the traditional way before the "External Attributes to Expose" functionality was added to Input port properties, and also it's still a frequently being used way to create generic custom transformers.
Many of FME Store transformers use the traditional way. I think they are good examples to learn how a custom transformer receives values through published parameters and stores them into internal attributes. I would recommend you to see some of them.
Takashi
So if I have 2 transformer inputs- each is from a separate input source-- Then I use a FeatureMerger inside the custom transformer, I need to know which join attributes to use from each input. All attributes/parameters appear available on both the requestor and the supplier. You are permitted to select an attribute/parameter that may not really exist on the Requestor and/or Supplier. The FeatureMerger seems to not have a problem with this (no red cog), but when you run it, you may have a logic problem. I have some old custom transformers living in several workbenches which probably date to FME 2011? which simply carry exposed attributes from outside to inside the custom transformer via separate custom transformer inputs. A FeatureMerger within those will only allow you to select join fields for the Requestor and the Supplier which pertain to their input ports, which are downstream of separate custom transformer inputs.
I would like to be able to still opt for this way of passing attributes into a custom transformer for times when I care more about following the logic/attributes/pipelines than about using the same custom transformer in other places. I think it is harder to author and troubleshoot a custom transformer when all the input attributes/parameters are showing as valid for 2 or more custom transformer inputs. It leads you to think attributes are available on inputs/pipelines which they really don't travel through.
No it does not. ;)
In older versions of FME (pre FME 2013), if custom transformers were only used once in the workspace, they automatically showed what was being input, leading to different attributes on different input ports.This only worked when there was a single instance
As I'm stuck the same way cdavid was and the different answers make me understand a solution i would like to share it with you.
Actually, custom transformer is NOT what respond to our research, in fact most of the transformers doesn't presume on what is the column format of the inputs whereas our preoccupation is to correctly have the input column structure in the correct input connector inside the custom parameter. And what i didn't understand is that when i change the attribute for 1 input it change for others too. Even more, that i don't need those attributes as published one.
So my thought was simply to replace the custom transformer by a bookmark that encompass all i've put in my transformer, here the attributes are correctly passing to the next transformer as there is no border between previous and next transformer.
I'm sure many of you will not understand what i'm talking about, cause it's more misunderstanding then a problem/bug, so you can see in the picture attached my structure where i replace J_update(custom transfo) by bookmark J_Update; but i also think that this could help others.
Last, the only thing that is not so easily manageable is when i want to make a change inside the bookmark. Not only becouse it's big and deform all my fme structure but cause i use it 5 times, so 1 change have to be reverberate 5 times, except by developping it for 1 and copy to others when i'm sure of the process.
As I'm stuck the same way cdavid was and the different answers make me understand a solution i would like to share it with you.
Actually, custom transformer is NOT what respond to our research, in fact most of the transformers doesn't presume on what is the column format of the inputs whereas our preoccupation is to correctly have the input column structure in the correct input connector inside the custom parameter. And what i didn't understand is that when i change the attribute for 1 input it change for others too. Even more, that i don't need those attributes as published one.
So my thought was simply to replace the custom transformer by a bookmark that encompass all i've put in my transformer, here the attributes are correctly passing to the next transformer as there is no border between previous and next transformer.
I'm sure many of you will not understand what i'm talking about, cause it's more misunderstanding then a problem/bug, so you can see in the picture attached my structure where i replace J_update(custom transfo) by bookmark J_Update; but i also think that this could help others.
Last, the only thing that is not so easily manageable is when i want to make a change inside the bookmark. Not only becouse it's big and deform all my fme structure but cause i use it 5 times, so 1 change have to be reverberate 5 times, except by developping it for 1 and copy to others when i'm sure of the process.
I think this is an opportunity for us to improve FME (it may even be an outright bug, depending on how you look at it) and in fact is already filed with our developers as FMEDESKTOP-5437.
I'm hoping this has a high priority to get fixed. In the meantime, your solution may work, but I urge you to treat it as a temporary workaround. Duplicating the same set of transformers multiple times is not good practice, and a custom transformer with a single definition is usually the recommended solution.
I hope that I will have news of a fix in the near future.