Skip to main content
Question

Attribute name from attribute value


Hi,

 

 

This subject is discussed already quite some times but I don't get it working.

 

I have a loop where a feature enters with 3 fields (field_name, field_value).

 

I want to use the AttributeCreator to make a field that is named after the value in "field_name" and gets the attribute value from "field_value".

 

As there is an option inside the AttributeCreator "Attribute Name from Attribute Value" is supposed this would do the trick. But this does not create a new attribute. If I type the actual field name in the "Attribute Name" field in the transformer it just works fine.

 

 

The attribute names are like this:

 

net_elements{0}.xlink_href

 

net_elements{1}.xlink_href

 

net_elements{2}.xlink_href

 

net_elements{3}.xlink_href

 

...

4 replies

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • June 16, 2014
Are you referring to @Value(@Value(att_name) ?

  • Author
  • June 16, 2014
For some reason the new attribute doesn't show up in the table view of my data inspector but only in the feature information window.

 

So actually it is working perfect.

takashi
Influencer
  • June 16, 2014
Hi,

 

 

The attributes which have not been exposed in the workspace will not appear in the Table View. This is the reason. It's the same situation as unexposed format attributes, e.g. "fme_dataset".

 

If you need to display them in the Table View, consider using the AttributeExposer to expose them.

 

 

Takashi

helmoetz
Supporter
Forum|alt.badge.img+14
  • Supporter
  • July 11, 2024

In summary:

You can use an AttributeManager to create an Output Attribute @Value(“field_name") with Attribute Value @Value("field_value”). Like takashi says, you have to expose the new attribute, unless you work with a dynamic schema in which case FME will recognize the created attribute as the same as defined in the schema. 

 


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