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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

City State Zip comma 1

Status
Not open for further replies.

schwarem

Programmer
Apr 18, 2002
159
US
I am using putting City, State, and Zip together into one field. I want to not include the Comma if City state and zip are not specified. Right now, if they are not specified, the comma still appears.
 
schwarem,

Try:

stringvar stateZip := trim({statefield} & " " & {zipField});
stringvar city := trim({cityfield});

If city = "" then
stateZip
else if stateZip = "" then
city
else
city & ", " & stateZip

Andy
 
Try:

{table.city}+
(
if isnull({table.city} and
isnull({table.state}) and
isnull({table.zip}) then
"" else
", "
) + {table.state}+" "+{table.zip}

This requires all three fields to be null in order to eliminate the comma. You might want to adjust and eliminate the null zip requirement.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top