1

The token {contact.postal_code}{contact.postal_code_suffix} is returning an extra hyphen at the end of the string: 10023-7890- not 10023-7890.

The actual content shown in the Settings - Addresses is as follows

{contact.addressee} {contact.street_address}
{contact.supplemental_address_1} {contact.supplemental_address_2}
{contact.city}{, }{contact.state_province}{ }{contact.postal_code}{-}{contact.postal_code_suffix}
{contact.country}

How can I get rid of it? Thanks, K.


Sorry - the cut & paste I did had the extra hyphen after country. However, the actual content shown in the Settings - Addresses is as follows: {contact.addressee} {contact.street_address} {contact.supplemental_address_1} {contact.supplemental_address_2} {contact.city}{, }{contact.state_province}{ }{contact.postal_code}{-}{contact.postal_code_suffix} {contact.country}

The extra hyphen after {contact.country} does not appear in the mailing label or address display format, but it is still appearing everywhere.

I've tried editing the address settings by adding each token but the problem remains. Any other thoughts?

  • Address display format configuration: {contact.address_name} {contact.street_address} {contact.supplemental_address_1} {contact.supplemental_address_2} {contact.city}{, }{contact.state_province}{ } {contact.postal_code}{-}{contact.postal_code_suffix} {contact.country} – GrannyKat Dec 2 '15 at 15:37
1

It looks like CiviCRM automatically includes the postal code suffix in the {civicrm.postal_code} token, so I think you can just remove the suffix and hyphen from your address configuration.

Using your stated configuration in Administer > Localization > Address Settings, I see the same behaviour on http://d46.demo.civicrm.org when printing address labels.

issue reproduced with suffix token

Using this format (with postcode suffix and hyphen removed), I see the suffix included in the output of the postal_code token.

{contact.addressee} {contact.street_address}
{contact.supplemental_address_1} {contact.supplemental_address_2}
{contact.city}{, }{contact.state_province}{ }{contact.postal_code}
{contact.country}

Results in -

fixed output no suffix token

  • Using an invisible space character instead of a hyphen might also give you an acceptable output for mailing, if you really do need to use the suffix token? I wonder why your format didn't duplicate the suffix value? Can you verify that your contacts actually have data in the suffix field? – Chris Burgess Dec 6 '15 at 9:11
0

You have use country field just after the postal code suffix field and you '-' after country. If country field value is is blank then obviously you will get '-' after postal code suffix.

  • Sorry - the cut & paste I did had the extra hyphen after country. However, the actual content shown in the Settings - Addresses is as follows: {contact.addressee} {contact.street_address} {contact.supplemental_address_1} {contact.supplemental_address_2} {contact.city}{, }{contact.state_province}{ }{contact.postal_code}{-}{contact.postal_code_suffix} {contact.country} The extra hyphen after {contact.country} does not appear in the mailing label or address display format, but it is still appearing I've tried editing the address settings by adding each token but the problem remains. – GrannyKat Dec 2 '15 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.