Skip to main content
Question

Custom transformer dynamic attribute name

  • November 14, 2012
  • 5 replies
  • 23 views

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
What is the best way to specify the output attribute name on a custom transformer?  I can add a paramter , but the logical transformer (AttributeCreator) let's me link the value of an attribute easily enough, but not it's name.

5 replies

sigtill
Supporter
Forum|alt.badge.img+24
  • Supporter
  • November 14, 2012
If I understand correctly you want to link an Attribute within a Customtransformer (for instance MyCustomTransformer) to an AttributeName?

 

 

Can the VariableSetter and VariableRetriever help you?

jdh
Contributor
Forum|alt.badge.img+28
  • Author
  • Contributor
  • November 14, 2012
What I would like is to specify the new attribute name that the custom transformer will spit out.  

 

 

In this particular case the custom transformer takes an attribute with a coordinatate in the form of CDD(D)MMmSmSmSmS and returns decimal degrees.  

 

 

I would like to use it twice in the main workspace and specify the name of the attribute that will contain the decimal degree value.

 

 

I already have it working to select which attribute to process, now I just need the other half.

jdh
Contributor
Forum|alt.badge.img+28
  • Author
  • Contributor
  • November 14, 2012
I know I can do the cleanup in the main workspace, but then I would have to pair the transformers everytime I used the custom transformer, which sort of defeats the purpose of wrapping all the functionality into one custom transformer.

mark2atsafe
Safer
Forum|alt.badge.img+44
  • Safer
  • November 14, 2012
Yes, use the AttributeRenamer.

 

 

1) create a text parameter to define the attribute name

 

2) create an attribute ("test" for example) with the correct value

 

3) In the attributeRenamer rename from test to $(aaa) where aaa is the name of the parameter created in step 1

 

 


jdh
Contributor
Forum|alt.badge.img+28
  • Author
  • Contributor
  • November 22, 2012
Hi Mark,

 

 

That worked for FME 2012, but it is slightly broken in FME2013.  The transformer shows the parameter reference $(a) on the transformer instead of resolving it.  However the inspector shows the correct attribute when the workspace in run.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings