Adding text to field if not already present


#1

Hi All,

Apologies if this has been covered, but i couldn't find anything. I've also looked at the FAQ but code is FAR from my strong-point.

I'm looking to add ' OST' (that's; _space_OST) to the end of all ARTIST field if not already present. I'd like it to be case sensitive and exact phrase match, too.

If anyone can help me out on this, i'd really appreciate it.


#2
  1. Appending something to a tag-field is standard theme of the FAQ area.

  2. Appending something in the case of while it does not already exist, this is a matter of checking out, whether some value exists or not.
    For your example this might be 'very easy'.

Look at the rightmost four characters ... $right(%ARTIST%,4).
Check the value against the given tag-field content ... $eql($right(%ARTIST%,4),' OST')
Make a decision what to do ... $if($eql($right(%ARTIST%,4),' OST'),%ARTIST%,%ARTIST%' OST')

DD.20120504.1850.CEST


#3

Thanks very much :slight_smile:
Worked perfectly.