Skip to main content

Hi All,

I am working with lists and require some guidance on the below scenario

I have list which contains 'n' elements. I would like to add a sub-element to each element in the list.

Assuming my list name called as "list{}"

Example: (My list currently looks like this)

    List{0}
        element1
        element2
        element3
    List{1}
        element1
        element2
        element3
    List{2}
        element1
        element2
        element3
    List{n}
        element1
        element2
        element3

        
I would like to add new sub-element called "element4" at the end of each list element (i.e., add "element4" as sub-element below "element3" )        

Expected Output (I would like to achieve something like below)

    List{0}
        element1
        element2
        element3
        element4
    List{1}
        element1
        element2
        element3
        element4
    List{2}
        element1
        element2
        element3
        element4
    List{n}
        element1
        element2
        element3
        element4


In Java world, I would ideally use looping to iterate through the list and add sub-element. Not sure how to perform similar scenario in FME. Would really appreciate your help in achieving the above expected output.

Thanks in advance

In the example you provided, one way would be to explode the list, add the extra attribute, and finally rebuild the list including the new attribute.

 


Reply