Page 1 of 1

Adding & Removing Spaces In An Address Field

PostPosted: Sun Feb 26, 2006 4:08 pm
by Ralph
Can someone help me?

I have a field titled "Address Line" which combines the values of fields "Title", "Spouse", "First Name" and "Last Name."

PROBLEM: This calculation adds a space before "First Name" if there is NO Title.
Title & " " & If(IsEmpty(Spouse:); ""; "and Mrs. ") & First Name & " " & Last Name

PROBLEM: This calculation takes out the space before "First Name" but then does NOT have a space between "Title" and "First Name" if there IS a "Title."
Title & If(IsEmpty(Title); "" ) & If(IsEmpty(Spouse:); ""; "and Mrs. ") & Name First & " " & Name Last

Can someone help me get the spacing correct? I'm sure the solution is fairly simple but I’m too simple to get anything to work.

Thanks,
Ralph

PostPosted: Mon Feb 27, 2006 7:04 am
by John Sindelar
Try just including the spacing in the true portion of the If test, like this:

Title &
if ( not ismepty( Spouse ) ; " and Mrs." ; "" ) &
if ( not ismepty( FirstName ) ; " " & FirstName ; "" ) &
if ( not ismepty( LastName ) ; " " & LastName ; "" )

Adding & Removing Spaces In An Address Field

PostPosted: Mon Feb 27, 2006 2:09 pm
by Guest
Thanks for the effort John, but your calculation does not remove the space before "FirstName" on the "Address Line" if there is no "Title."

Anything else I can try?

Thanks,
Ralph

PostPosted: Tue Feb 28, 2006 4:58 am
by John Sindelar
Sorry, I just read that wrong. How's this:

Trim (
if ( not ismepty( Title ) ; Title & " " ; "" ) &
if ( not ismepty( Spouse ) ; "and Mrs. " ; "" ) &
if ( not ismepty( FirstName ) ; FirstName & " " ; "" ) &
if ( not ismepty( LastName ) ; LastName & " " ; "" )
)

PostPosted: Tue Feb 28, 2006 12:17 pm
by Ralph
John,

You rock! Thanks - it works just great. I really appreciate your efforts. It's no wonder Cleveland Consulting is rapidly becoming known as the place to go to if you're having problems with FM.

Ralph