About Attribute Lists
What can I do with attribute lists?
If you know which element of a list you want, you can expose it directly in FME Workbench and then treat it as you would any other attribute. Alternately, you can use the ListIndexer transformer to demote elements of a structured list into full attributes, and the index can be either a number you provide directly, or one that you extract from another attribute on the feature.
For example, if a feature has these attributes on it:
overlaps{0}.direction -1
overlaps{0}.line_id 50
overlaps{1}.direction 1
overlaps{1}.line_id 22
overlaps{2}.direction 1
overlaps{2}.line_id 40
overlaps{3}.direction -1
overlaps{3}.line_id 12
and it went through a ListIndexer with an index of 2, then the feature would emerge with these attributes:
direction 1
line_id 40
overlaps{0}.direction -1
overlaps{0}.line_id 50
overlaps{1}.direction 1
overlaps{1}.line_id 22
overlaps{2}.direction 1
overlaps{2}.line_id 40
overlaps{3}.direction -1
overlaps{3}.line_id 12
Note that the list itself was not changed, but the attributes at index 2 were demoted down from the list to become regular attributes.
Other List Operations
Other list operations available include searching a list (ListSearcher) for a particular value, counting the number of elements in a list (ListElementCounter), concatenating all the elements of a list into a single attribute (ListConcatenator), and exploding a list by creating a new feature for each element in the list and adding the demoted attributes to it (ListExploder).
The ListExploder is sometimes used to create individual features for each list element, so that they can be written to a relational database table. In this way, the 1 to many nature of the data model can be preserved by writing the original feature to one table, and the exploded list element features to another table. As long as there is a key field that can be used to rejoin them, the relationship is maintained. Furthermore, there is no requirement that the format used to store the list elements be the same as the format used to store the master feature – very often the exploded list element records are stored in a database table and the master feature is stored in a GIS or CAD system.
Another use of the ListExploder is to make copies of the feature for each list element, and then these copies may be sorted by some criteria (such as length or area), and lastly the elements run through a DuplicateFilter transformer to select only the largest or smallest feature that was originally an element of a list.