Topic Options
#24674 - 09/25/09 02:52 PM Spaces between Variables
KesslerCreative Offline
OL Newbie

Registered: 09/25/09
Posts: 2
Loc: Jacksonville, FL
I am trying to figure out the best code to put a space between a prefix and a first name, if a prefix exists, and no space if a prefix does not exist.

My variables look like: @prefix@@firstname@@lastname@

If I put a space between @prefix@ and @firstname@ the address lines without a prefix look like they are indented, which the customer does not want.

I have tried using an IF expression to add a blank space but I can't get it to work right... any better ideas or suggestions?

Top
#24675 - 09/25/09 03:02 PM Re: Spaces between Variables
Anonymous
Unregistered


Hi,

You could do this by removing the @prefix@ variable and the space, and changing the @firstname@ variable expression to something like this:

IF(LEN([Prefix]) > 0, [Prefix] & " " & [FirstName], [FirstName])

Which basically translate as "if the length of the Prefix string is more than 0 (not empty), print the prefix, then a space, then the first name. Else, print just the firstname".

Hope this helps,
Eric.

Top
#24676 - 10/22/09 06:33 AM Re: Spaces between Variables
Wim Offline
OL Newbie

Registered: 11/07/07
Posts: 11
Loc: Brussel
Hi,

You can use the trim command:

trim(trim(trim([prefix]) & " " & trim([firstname])) & " " & trim([lastname]))

Wim

Top