Skip to main content

Dear all,

 

Very simple question (sorry if it sounds naive, I am newbie to FME) : I would like to set to uppercase all attributes that start with a given prefix (or that match a given pattern). Is it possible to do that with the BulkAttributeRenamer ? Or what would be the ''cleanest'' way to do that without using custom transformers ?

 

(NB : I know I could achieve this with a custom transformer (for example, inspired by this question), but I would like to avoid this kind of solution as then I face the tricky issue of having attributes that need to be dynamically exposed and I would like to avoid also the complicated things with schema mapping and so on...)

 

I would be very grateful if you could share how you would implement that 😀

 

Thanks in advance for any suggestion

 

Hi @mzuer​ 

It all depends upon how many conditions you have.

You could quite easily setup a Tester, make it Case Sensitive or Insensitive depending upon your requirements.

Filter the attributes accordingly, then use String Replacer or Bulk Attribute Replacer as necessary:

image 

The example above, I created an attribute called AttributeX, with a value of Starter and starter.

I filtered it via the Tester, make sure it was Case Sensitive, to show if it begins with S then using String Replacer, I replaced Start with End.


I'm not sure i'd ever try to do it this way, but i think in theory it should be possible. If the prefix is abc, remove all attributes that start with abc and send this feature one direction, add an abc prefix to a unique id, then remove all attributes that don't start with abc. Convert all remaining attributes to uppercase, featuremerge to aggregate the features into a single feature with all attributes.

 

image


I think this is what you mean:

imageAll features go trough the top and bottom and are merged to themself at the end.

Bottom features keep the lowercase attributes, top features keep the uppercase attributes that are converted to uppercase.

 


Ha! we all had the same kind of idea. Amazing how annoying it was when it would have been much easier to just be able to specify a regex to determine which attributes should upper/lowercase.


Ha! we all had the same kind of idea. Amazing how annoying it was when it would have been much easier to just be able to specify a regex to determine which attributes should upper/lowercase.

It was what I expected to do in my first try.

 

Also tried @Uppercase(@CurrentAttribute()) in the Rename. But this gave an Attribute with that name.


I think this is what you mean:

imageAll features go trough the top and bottom and are merged to themself at the end.

Bottom features keep the lowercase attributes, top features keep the uppercase attributes that are converted to uppercase.

 

not as straightforward as I imagined it could be possible to be, but thanks for sharing this solution


Thanks for the information

 


Reply