I'm trying to clean up a field and need to apply two functions in the load script. I've read through several other discussion posts and just can't seem to get the right syntax for this to work.
These are the two functions that I'd like to combine (both work as expected on their own). Any help is much appreciated.
If(Len(Trim(Instructor_Name)) > 0, Instructor_Name, 'None Specified') as [Instructor name], //Replaced blanks with text
Replace (Instructor_Name,' ',' ') as [Instructor name], //Removes extra spaces between instructor names
Thanks in advance!
Solved! Go to Solution.
Hi Ryan, you can use Trim to remove the extra spaces:
If(Len(Trim(Instructor_Name)) > 0, Trim(Instructor_Name), 'None Specified') as [Instructor name]
It was just to give an idea, the comments says "Removes extra spaces between instructor names" but the code will only work if there are exactly two spaces, not three or more.
Sunny, thanks so much. I was trying to add the Replace before/after the Trim, not combining the two as you've done, which is obviously why I didn't work.
Thanks Ruben! I was trying to remove cases where people's names had an accidental double space between first and last. My first attempt at solving this was with Trim, but realized I couldn't use it to remove extra spaces inside a string.