Skip to main content
Solved

ListKeyValuePairCreator


erik_jan
Contributor
Forum|alt.badge.img+17

Hi all,

I am looking for a transformer that does the opposite of the ListKeyValuePairExtractor.

It needs to create a list with FIELD_NAME and FIELD_VALUE pairs for all the attributes on a feature.

I checked the transformer gallery and the FME Hub, but could not find such a transformer.

Has anybody a solution?

Could be a Python script.

 

Thanks in advance.

Erik

Best answer by debbiatsafe

Hello @erik_jan 

If you are looking for a transformer that can create a list structured like:

_list{0}.FIELD_NAME = "Field 1"
_list{0}.FIELD_VALUE = "Value 1"
_list{1}.FIELD_NAME = "Field 2"
_list{1}.FIELD_VALUE = "Value 2"

Try the AttributeExploder with the Exploding Type parameter to ‘List’. You should be able to select the name of the output list as well as the name of the exploded attribute and value in the Output Attribute Names parameter section.

If you are looking to create a list that looks like:

_list{0}.FIELD1 = "Value 1"
_list{0}.FIELD2 = "Value 2"

Then try the ListBuilder.

View original
Did this help you find an answer to your question?

2 replies

debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • Best Answer
  • June 26, 2024

Hello @erik_jan 

If you are looking for a transformer that can create a list structured like:

_list{0}.FIELD_NAME = "Field 1"
_list{0}.FIELD_VALUE = "Value 1"
_list{1}.FIELD_NAME = "Field 2"
_list{1}.FIELD_VALUE = "Value 2"

Try the AttributeExploder with the Exploding Type parameter to ‘List’. You should be able to select the name of the output list as well as the name of the exploded attribute and value in the Output Attribute Names parameter section.

If you are looking to create a list that looks like:

_list{0}.FIELD1 = "Value 1"
_list{0}.FIELD2 = "Value 2"

Then try the ListBuilder.


erik_jan
Contributor
Forum|alt.badge.img+17
  • Author
  • Contributor
  • June 27, 2024

Thanks @debbiatsafe ,

That worked perfectly.

Exactly what I needed.

Erik


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