Tip # Formatting address for templates

Tip # Formatting address for templates

Blank lines in address blocks in any output look ugly.

Get rid of them by using the following code in a custom field.

Make sure the "Formula Return Type" is set to String.

This was designed for the Quotes module so you'll need to replace the filed names ( the ${Module.FieldName} ) if you' are working in a different module.
  1. Concat(
  2. If(Len(Trim(${Quotes.Billing Street}))>0,${Quotes.Billing Street},''),
  3. '<br/>',
  4. If(Len(Trim(${Quotes.Billing City}))>0,${Quotes.Billing City},''),
  5. '<br/>',
  6. If(Len(Trim(${Quotes.Billing State}))>0,${Quotes.Billing State},''),
  7. '<br/>',
  8. If(Len(Trim(${Quotes.Billing Country}))>0,${Quotes.Billing Country},''),
  9. '<br/>',
  10. If(Len(Trim(${Quotes.Billing Code}))>0,${Quotes.Billing Code},'')
  11. )

Save yourself a lot of heart ache - always click the "Check Syntax" button after each change.