Question

list flattening

  • 25 March 2018
  • 6 replies
  • 41 views

Badge

Hi All,

Just wondering what is the best option to flatten a list on each row to attributes? I know the lists are set at the same size index wise but wondering on the best method

thanks


6 replies

Userlevel 3
Badge +17
Depends on what "to flatten list" means. For example, if the feature has a list called "_list{}" containing these elements, what would be your desired result?

 

_list{0} = 'a'
_list{1} = 'b'
_list{2} = 'c'

 

Badge

Hi Takashi,

I would be happy with new attributes against the same parent row i.e. list0 = a, list1 = b and list2 = c.

I was looking at the exposer but thought there must be a simpler approach?

Badge +16

Have a look at the listexploder

Userlevel 5
Badge +30

Have a look at the listexploder

I agree wit you

 

 

Badge
I agree wit you

 

 

Hi,

 

 

Does this not just create 3 rows - i need them all on the original row?

 

 

Thanks
Userlevel 3
Badge +17

Hi @lemzip, I think the BulkAttributeRenamer (Regular Expression Replace, Rename mode) can be used effectively here. If you exposed the list elements in the preceding transformer (Right-click on the list name - Expose Elements), the renamed attributes would be exposed automatically.

Text To Find: ^(_list){(\d+)}$  <regular expression that match every element of the list>
String: \1\2  <concatenate the parts matched sub expressions>

0684Q00000ArK83QAF.png

Reply