Skip to main content
Question

Dynamically transform elements of a list into attributes


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

2 replies

takashi
Influencer
  • 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
takashi wrote:

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


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