Skip to main content
Solved

Map list values to attribute values


sunsilk11
Contributor
Forum|alt.badge.img+6

Hi I have used JsonFragmenter to read a json file and have ended up with a set of attribute values plus a list of values for each feature. I need to write the list to single attributes in a table based on the index. (see attached)

e.g Signalstatus[0] written to field STATUS_0

Signalstatus[1] -> STATUS_1 e.tc.

Any suggestion ?

Best answer by jdh

There is sadly no listFlattener transformer.

 

You can however use the BulkAttributeRenamer with Regular Expression Replace

 

Text to Find: ^Signalstatus{(\\d+)}$

 

String: STATUS_\\1

EDIT: use the exact list name in the data, based on the png it would likely be ^Statuslist\\.Signalstatus{(\\d+)}\\.Status$

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

3 replies

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • Best Answer
  • October 9, 2018

There is sadly no listFlattener transformer.

 

You can however use the BulkAttributeRenamer with Regular Expression Replace

 

Text to Find: ^Signalstatus{(\\d+)}$

 

String: STATUS_\\1

EDIT: use the exact list name in the data, based on the png it would likely be ^Statuslist\\.Signalstatus{(\\d+)}\\.Status$


geosander
Forum|alt.badge.img+7
  • October 9, 2018

Or use a ListRenamer followed by a ListKeyValuePairExtractor (on FME Hub).


takashi
Influencer
  • October 10, 2018
jdh wrote:

There is sadly no listFlattener transformer.

 

You can however use the BulkAttributeRenamer with Regular Expression Replace

 

Text to Find: ^Signalstatus{(\\d+)}$

 

String: STATUS_\\1

EDIT: use the exact list name in the data, based on the png it would likely be ^Statuslist\\.Signalstatus{(\\d+)}\\.Status$

Good suggestion.

 

If you expose the list elements under a prior transformer (right-click on the list name > Expose Elements > Select List Elements), the BulkAttributeRenamer would expose destination attribute names automatically, for what it's worth.

 


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