cancel
Showing results for 
Search instead for 
Did you mean: 

Combine addresses

Former Member
0 Kudos
130

Post Author: leongcy23

CA Forum: Formula

Hi all,

I have a situation here where I need to combine all the field like Address1, Address2, Address3, Zip, City, State, Country in one formula. My formula is like this : {ContSupp.ADDRESS1}" "{ContSupp.ADDRESS2}" "{ContSupp.ADDRESS3}" "{ContSupp.ZIP}" "{ContSupp.CITY}" "{ContSupp.STATE}" "{ContSupp.COUNTRY}

But I find that the formula won't work if I leave either one of the field empty. It only work when all the field are filled in. If I use if-else function, it will be a long list of formula.

Anyone got any idea on this? Appreciate for help. Thanks

Anson

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Post Author: leongcy23

CA Forum: Formula

Thanks Kai for your 'lecture'. I will be a 'good student' next time.

Thanks for your suggestion. Although its not up to my expectation, but its still solve my problem.

Appreciate for that.

Former Member
0 Kudos

Post Author: synapsevampire

CA Forum: Formula

Why would each field be seperated by a space? That's very odd.

Generally people are trying to create mailing address blocks, so they right click the details and select insert section below, and place each field of the address in a seperate detail section, and then turn on each detail sections suppress if blank formatting.

But you want a space netween them...perplexing requirement...

So use File Report Options and turn on convert null values to default (the actual menu choices are Crystal version dependent, and you didn't bother to post that):

trim({ContSupp.ADDRESS1})" "trim({ContSupp.ADDRESS2})" "trim({ContSupp.ADDRESS3})" "trim({ContSupp.ZIP})" "trim({ContSupp.CITY})" "trim({ContSupp.STATE})" "trim({ContSupp.COUNTRY})

Again,so very odd to ask for that...

If you want them seperated by a carriage return instead, use:

trim({ContSupp.ADDRESS1})chr(13)trim({ContSupp.ADDRESS2})chr(13)trim({ContSupp.ADDRESS3})chr(13)trim({ContSupp.ZIP})chr(13)trim({ContSupp.CITY})chr(13)trim({ContSupp.STATE})chr(13)trim({ContSupp.COUNTRY})

In future posts, please try to post environment and requirements rather than showing bad code and asking us to fix it without knowing what the output requirements are...

Crystal version?Database?Example data?Expected Output?

And what is up with that subject/topic, reply to an existing message? How is that in any way related to this subject matter?

Please use subjects that others will understand as relevant to the request within, the point of these forums isn't to offer you a technical slave, it's to assist the world with resolving problems, so having searchable, logical threads is important.

Hope this resolves this for you.

-k