So what you want is the custom transformer instance name, not the custom transformer name.
You can get that via one of two hacks.
Using a pythonCaller inside the customa transformer.
With a FeatureProcessor object, self.factory_name is {custom transformer instance name}_{PythonCaller instance name}.
class FeatureProcessor(object):
def __init__(self):
pass
def input(self,feature):
feature.setAttribute("Name", self.factory_nameu:-13])
self.pyoutput(feature)
def close(self):
pass
where the length of the slice depends on the name of the pythonCaller transformer
If you want to avoid python
Inside the custom transformer you can use a ParameterFetcher set to {TransformerName}_WORKSPACE_NAME.
So if the custom transformer was called ERR then you would set it to ERR_WORKSPACE_NAME, and it would return ERR006. The reason it's a hack, is that the parameter name is considered invalid. You will get the red wheel, but if you ignore it and run the workspace anyhow it works.
Fantastic :)
Thanks for help.
I prefer solution with the PythonCaller but the other method works also well.
The only drawback with the ParameterFetcher is that the transformer shows an error, however the workspace runs well with no errors and the results are good. Is it possible to get rid of the read error symbol on the transformer?
Thanks!!!
Fantastic :)
Thanks for help.
I prefer solution with the PythonCaller but the other method works also well.
The only drawback with the ParameterFetcher is that the transformer shows an error, however the workspace runs well with no errors and the results are good. Is it possible to get rid of the read error symbol on the transformer?
Thanks!!!
That's the reason I called it a hack and not a solution. There's nothing we can do to make the parameter valid. It would require a change to the software.
Maybe post an idea along the lines of "FME Macro Values should be valid parameter names in the ParameterFetcher"
Fantastic :)
Thanks for help.
I prefer solution with the PythonCaller but the other method works also well.
The only drawback with the ParameterFetcher is that the transformer shows an error, however the workspace runs well with no errors and the results are good. Is it possible to get rid of the read error symbol on the transformer?
Thanks!!!
Thanks, both hacks are great :)
Wow, great solutions. Would a VariableSetter/VariableRetrieve combination work as well?
Wow, great solutions. Would a VariableSetter/VariableRetrieve combination work as well?
Not that I am aware of? How would get the value to set in the VariableSetter?