Page 1 of 1

blank info

Posted: Fri Dec 18, 2009 7:03 am
by Royle
I am setting up a label with these fields on one line Sal Firstname middle last name. i have a space between each field in the label. If i don't place the space between each field they but up against each other

Ssome of the Sal and middle fields are blank. in the label it leaves a blank pace when the field is blank. is there a way to correct this?

Posted: Mon Dec 28, 2009 3:23 pm
by pilviaccuzip
You can simply use the reduce function.

Normally your expression (that doesn't quite do what you want) might look like:
alltrim(alltrim(sal)+" "+alltrim(first)+" "+alltrim(mid)+" "+alltrim(last))
which will get rid of the leading space if sal is blank but will leave two spaces between First and Last when Mid is blank.

To solve this:
reduce(sal+" "+first+" "+mid+" "+last)

The reduce function gets rid of all trailing and leading spaces for the entire string and reduces any double or more spaces between substrings. It does the trick for me.

I hope this helps!

Pilvi