I have a vector layer containing around 17000 polygons with a field named 'theme'. Each polygon of the layer has one of 30 unique values (e.g. buildings, roads etc.) assigned to this field. I now want to add a field to each polygon, the field should be named after the field 'theme' and contain the area of the polygon (e.g. a Polygon with the attribute 'buildings' in the field 'theme' gets a new field called 'buildings' containing it's area).
In Model Builder I can use the expression editor for the field name, my thinking was that I could get what I want with the expression:
attribute( $currentfeature ,'theme')
which does not add any new fields to the output at all (it does not generate any errors as well though).
Is this possible with Model Builder? Did I even use the correct expression or do I need to write some code to get this done?
The only way I found that works is creating 30 field calculators, one for each unique value and a lot of expression madness to only populate certain fields for certain values, since the Values might differ on a project basis this is really time consuming.