Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display Address Fields as a New Line

Status
Not open for further replies.

rwn

Technical User
Dec 14, 2002
420
US
I have a formula called @Address that uses fields from a Customer Table. I would like to have each field be displayed in a new line. So the first field is the text "Customer", then a new line for (Address.Name), a new line for (Address.Line1), a new line for (Address.Line2), a new line for (Address.City), (Address.State),(Address.Zip).
@Address Formula:
"Customer"+
(Address.Name)
{Address.Line1}+
{Address.Line2}+
{Address.City}+{Address.State}+" "+{Address.Zip}

 
use chr(13) in you formula where you want the line return.
it is a 'enter'

"Customer" & chr(13) &
(Address.Name) & chr(13) &
{Address.Line1} & chr(13) &
{Address.Line2} & chr(13) &
{Address.City}+{Address.State}+" "+{Address.Zip}



you also may want to change to using variables and checking for null values in the addresses...something like this:
stringvar addN;
stringvar addL1;
stringvar addL2;
stringvar city;
stringvar state;
numbervar zip;

If isnull({Address.Name} then addN := " "
ELSE addN := {Address.Name};
IF isnull({Address.City}) then city := " "
ELSE city := {Address.City} ;
etc



addn & chr(13) &
addL1 & chr(13) &
etc
 
Thanks, I didn't realize that chr(13) was the return.

As for the NULLS, here is what I tried with no success.
stringvar addN;
stringvar addL1;
stringvar addL2;
stringvar city;
stringvar state;
numbervar zip;
"Customer" & chr(13) &
If isnull({Address.Name}) then addN := " "
ELSE addN := {Address.Name}& chr(13);
If isnull({Address.Line1}) then addN := " "
ELSE addL1 := {Address.Line1}& chr(13);
If isnull({Address.Line2}) then addN := " "
ELSE addL2 := {Address.Line2}& chr(13);
If isnull({Address.City}) then addN := " "
ELSE addL2 := {Address.City}& chr(13);

"Customer" & chr(13) &
addn & chr(13) &
addL1 & chr(13) &
addl2 & chr(13) &
addL1 & chr(13) &
city + state + " " + zip
 
Tweeked and much better, but the spaces between rows hve an extra space.
stringvar addN;
stringvar addL1;
stringvar addL2;
stringvar city;
stringvar state;
numbervar zip;
"Customer" & chr(13) &
If isnull({Address.Name}) then addN := " "
ELSE addN := {Address.Name}& chr(13);
If isnull({Address.Line1}) then addL1 := " "
ELSE addL1 := {Address.Line1}& chr(13);
If isnull({Address.Line2}) then addL2 := " "
ELSE addL2 := {Address.Line2}& chr(13);
If isnull({Address.City}) then city := " "
ELSE city := {Address.City}& chr(13);

"Customer" & chr(13) &
addn & chr(13) &
addL1 & chr(13) &
addL2 & chr(13) &
{Address.City}+{Address.State}+" "+{Address.Zip}
 
It's simpler if you just put each field in its own detail section and then format each section to "suppress blank section"--which will take care of any nulls.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top