Skip to main content
There are cases where users need to create a structured list after splitting two or more attributes corresponding each other.
e.g.
Source attributes:
Names = 'aaa,bbb,ccc'
Types = 'x,y,z'
Values = '1,2,3'
Required list:
_list{0}.Name = 'aaa', _list{1}.Name = 'bbb', _list{2}.Name = 'ccc'
_list{0}.Type = 'x', _list{1}.Type = 'y', _list{2}.Type = 'z'
_list{0}.Value = '1', _list{1}.Value = '2', _list{2}.Value = '3'

To ease that,
- add an parameter (optional) to the AttributeSplitter, so that the user can specify component (member) name that will be added to the resulting list name.
and/or
- enhance the functionality of ListRenamer (List Action: Rename), so that the user can add a component (member) name to the selected list name optionally. i.e. allow set "_newName{}.member" for "_oldName{}".

I would also like to see an enhancement to the ListRenamer to turn a simple list into a structured list.


Yes, hope the enhancement will be done.

I found two workarounds except Python/Tcl scripting so far.

1. Split the source comma-separated values with AttributeSplitters, then rename the lists with a BulkAttributeRenamer.

'

2. Create a JSON from the source comma-separated values, then flatten it into a structured list.

'

JSON Template Expression

{ "_list" : [ let $types := fn:tokenize(fme:get-attribute("Types"), '\\s*,\\s*') let $values := fn:tokenize(fme:get-attribute("Values"), '\\s*,\\s*') for $name at $i in fn:tokenize(fme:get-attribute("Names"), '\\s*,\\s*') return { "Name" : $name, "Type" : $types[$i], "Value" : $values[$i] } ] } Anyway you need to expose the resulting lists and hide/remove unnecessary attributes, it's annoying.
In my particular case I'm not starting with a csv, the data is already in a simple list and I need it to become a structured list.

 


@jdh, starting with multiple simple lists, JSON approach can also be applied, but I would use the BulkAttributeRenamer. If the number of components is just two, the ListZipper from FME Hub can also be used alternatively.

 

How do you resolve the case now?

 


I was able to create a workaround that avoided the need for a structured list,and filed a bug as case C130961. (Using the Deaggregator with the list attribute to explode being a simple list does not make for happy results)