Skip to main content

What I want to achieve is:

colour is split into list attribute colour{}

nationality is split into list attribute nationality{}

status is split into list attribute status{}

size is split into list attribute size{}

shape is split into list attribute shape{}

etc. in one go.

 

Thanks for you help

Hi @friedhelm​ ,

 

maybe I have found a solution. The method is a bit different but I think it should work.

 

The basic idea is to use a unique identifier for each feature, create attribute <name, value> pairs (eg. <color, somecolor>, <status, somestatus>, etc.) and split the values with a separator character. The unique identifier can help to keep track of the original feature that the new features came from.

 

In the attached example:

  • the unique identifier is '_creation_instance';
  • the AttributeCreator creates some string in ISO date time format ("T" is the character used to separate the date part from the time part and is choosen as splitter in the next steps);
  • the AttributeSplitter splits by "T".

 

Hope that helps!

 


@davtorgh​ BulkAttributeRenamer can be used to rename lists. Not an obvious choice, but you can use it to demote and promote lists when the ListRenamer sometimes isn't flexible enough. For example:

    array{0}.name1

    array{1}.name2

to

name1

name2

using a regex:

array\\{\\d+\\}\\.

 

In your case, you can rename all the lists to a complex list, then a single AttributeExploder should do the trick:

status{}

nationality{}

to

mylist{}.status

mylist{}.nationality

AttributeExploder on mylist{}

In BulkAttributeRenamer, the regex you can use is:

(\\w+){(\\d)}

and replacement string:

mylist{\\2}.\\1

In the regex, the () creates capture groups and then in the replacement string, the \\1 & \\2 are those groups. So (\\w+) captures the name of the attribute and (\\d) the index.

dialogI've attached an example workspace

All this assumes that you have the same number of list elements in all your lists

 

 


Hi @friedhelm​ ,

 

maybe I have found a solution. The method is a bit different but I think it should work.

 

The basic idea is to use a unique identifier for each feature, create attribute <name, value> pairs (eg. <color, somecolor>, <status, somestatus>, etc.) and split the values with a separator character. The unique identifier can help to keep track of the original feature that the new features came from.

 

In the attached example:

  • the unique identifier is '_creation_instance';
  • the AttributeCreator creates some string in ISO date time format ("T" is the character used to separate the date part from the time part and is choosen as splitter in the next steps);
  • the AttributeSplitter splits by "T".

 

Hope that helps!

 

Hi thanks - I will check if this works for me.

Best regards

Kind regards,
Friedhelm Moggert-Kägeler
Solutions Director
Maritime Spatial Data



SevenCs GmbH
Atlantic Haus
Zirkusweg 1, 20359 Hamburg, Germany
Phone +49 40 851 72 40
Fax +49 40 851 72 479
www.sevencs.com

Hi @friedhelm​ ,

 

maybe I have found a solution. The method is a bit different but I think it should work.

 

The basic idea is to use a unique identifier for each feature, create attribute <name, value> pairs (eg. <color, somecolor>, <status, somestatus>, etc.) and split the values with a separator character. The unique identifier can help to keep track of the original feature that the new features came from.

 

In the attached example:

  • the unique identifier is '_creation_instance';
  • the AttributeCreator creates some string in ISO date time format ("T" is the character used to separate the date part from the time part and is choosen as splitter in the next steps);
  • the AttributeSplitter splits by "T".

 

Hope that helps!

 

Great - together with the solution markatsafe proposed this worked for me. Thank you!


@davtorgh​ BulkAttributeRenamer can be used to rename lists. Not an obvious choice, but you can use it to demote and promote lists when the ListRenamer sometimes isn't flexible enough. For example:

    array{0}.name1

    array{1}.name2

to

name1

name2

using a regex:

array\\{\\d+\\}\\.

 

In your case, you can rename all the lists to a complex list, then a single AttributeExploder should do the trick:

status{}

nationality{}

to

mylist{}.status

mylist{}.nationality

AttributeExploder on mylist{}

In BulkAttributeRenamer, the regex you can use is:

(\\w+){(\\d)}

and replacement string:

mylist{\\2}.\\1

In the regex, the () creates capture groups and then in the replacement string, the \\1 & \\2 are those groups. So (\\w+) captures the name of the attribute and (\\d) the index.

dialogI've attached an example workspace

All this assumes that you have the same number of list elements in all your lists

 

 

Thanks - BulkAttributeRenamer was a good idea.


Reply