Question

create / rename attribute based on string

  • 25 March 2020
  • 2 replies
  • 4 views

Badge +1

I am trying to create multiple attributes based on the string in a single attribute. E.g. I have a series of features with percentages for each.

I want to create an attribute for each feature. There may be multiple features with the same name.

 

This is the example source

Week NoUser% 1Tim151Sam252Tim122Sam193Tim93Sam104Tim254Sam15Tim145Sam726Tim526Sam3

 

And this is what I want it to output

 

Week 1 %Week 2 %Week 3 %Week 4 %Week 5 %Week 6 %Tim15129251452Sam2519101723

 

I have tried BulkAttributeRenamer and cant get it to work.

This is how I tried it (one of many attempts).

 

any help on this would be great.

Thanks

Seb


2 replies

Userlevel 2
Badge +16

If you use the down arrow, next to the String field, you can chose the Text Editor.

That allows you to put in the String field: Week @Value(Weekno).

Only change the % attribute.

Then use Aggregator (group by the user attribute) to merge the lines.

That should result in what you want.

Hope this helps.

Userlevel 1
Badge +21

I think there is an issue with the BulkAttributeRenamer in certain versions of FME which means it's not possible to add a suffix. I'll see if i can find the link.

It's not the best to use if you are trying to use an attribute to assign the suffix anyway

I'd use an attribute creator like this and then expose the attributes if necessary

It'll show a red cog but it will still work, if red cogs offend you can put the first statement in a separate attribute creator

Reply