Skip to main content
Question

Dynamically transform elements of a list into attributes

  • June 5, 2020
  • 2 replies
  • 72 views

mr_fme
Enthusiast
Forum|alt.badge.img+9

Hi,

 

I have a coordinated call list, with the values below. My problem is this list: I never know the number of elements that can come into it. How can you create a dynamic method of reading this list and already create attributes, such as: latitude1, longitude1, latitude2, longitude2, latitude3, longitude3 ....

 

"coordinate" : {[

"latitude" : "-23.2229628000",

"longitude" : "-35.9099781000","latitude" : "-33.2229628000",

"longitude" : "-25.9099781000","latitude" : "-33.2229628000",

"longitude" : "-15.9099781000","latitude" : "-33.2229628000",

"longitude" : "-25.9099781000"]}

 

Thank´s

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

takashi
Celebrity
  • June 5, 2020

Hi @mr_fme, you can use two StringSeachers and a BulkAttributeRenamer with the settings shown in the screenshot below to convert the source text to individual attributes - latitude0, latitude1, latitude2, ..., longitude0, longitude1, longitude2, .... Assuming that an attribute called "coordinate" stores the source text.

FME Workbench won't expose resulting attribute names automatically. However, if you expose the list elements in the StringSearcher manually (right-click on the list name > Expose Elements), the BulkAttributeRenamer exposes the resulting attribute names, as in:


mr_fme
Enthusiast
Forum|alt.badge.img+9
  • Author
  • Enthusiast
  • June 8, 2020

Hi @mr_fme, you can use two StringSeachers and a BulkAttributeRenamer with the settings shown in the screenshot below to convert the source text to individual attributes - latitude0, latitude1, latitude2, ..., longitude0, longitude1, longitude2, .... Assuming that an attribute called "coordinate" stores the source text.

FME Workbench won't expose resulting attribute names automatically. However, if you expose the list elements in the StringSearcher manually (right-click on the list name > Expose Elements), the BulkAttributeRenamer exposes the resulting attribute names, as in:

Thank´s @takashi helped a lot