I am trying to create a script that will check if a field contains a certain string of text (in this case I'm specifically looking for a name) and if it does contain that specific string then the script will replace that text with something else.
As an example. Let's say there is a field called ExperimentLeader. I know that there are going to be 4 possible entries into this field (Mr. Smith, Mr. Jones, Mrs. Johnson and Ms. Wood) and there will be multiple records for each of these contacts. However, there will be mutiple different people entering the data and they may enter things like John Smith, K. Jones, Wood, etc. I want the script to be able to read what has been entered into the field and notice the last names. If the script sees "Wood" then it will automatically output "Ms. Joanna Wood".
I have tried to create this script and this is what I've come up with:
If [GetField ("ExperimentLeader") = "Wood"] Set Field [table::ExperimentLeader; "Ms. Joanna Wood"] End If
This works if the text entered into the field is "Wood", but does not return the desired result if there is anything else in the field. Is there any way for me to modify this so that as long as the field *contains* "Wood" then the result will be "Ms. Joanna Wood"?
I am using FM Pro 10 on Mac OS Leopard and I have just started using FM.
I know it's possible to create an unmodifyable value list and use that for validation. However, if I import anything from a tab delimited text file (which I plan on doing quite often) it seems the imported records are not required to match the value list. I thought a script running on an OnObjectModify script trigger would be able to do the trick.