0

Fairly new to CR and i am looking for some help,

Basically I want to show my address in a text box containing the fields as follows

{Company}
{AddLine1}
{AddLine2}
{ZIP} {City} {State}
{Country}

I have these all displaying properly in the text box when all fields are entered in the database. The real problem is in the zip, city, state line. I need to space these to keep them separate so i have simply inserted a space in between each one, but the spaces show up when the ZIP field is not filled in the database and the city field then is indented in preview. The ZIP is suppressed if not entered so that is not the problem, just the spaces between zip, city and state. Is there anyway of diplaying the spaces when they are entered so that the address is spaced correctly, but also not displaying the spaces when a field is not entered so that this line is not indented? I think it may be a formula i need for this? Maybe something like this?

If IsNull ({customer.ZIP}) Then
{customer.CITY} + " " + {customer.STATE}
Else
{customer.ZIP} + " " + {customer.CITY} + " " + {customer.STATE}

Thanks for the Help, Much appreciated

Matt
  • 22,721
  • 17
  • 71
  • 112
Damien Moran
  • 135
  • 2
  • 13
  • You've got the right idea. Just create a formula to check for nulls and format accordingly. Is that not working for you? – Ryan Aug 23 '12 at 15:24
  • See my suggestion for handling this in your other thread: http://stackoverflow.com/questions/12095314/formula-wont-display-when-fields-certain-fields-are-null – Ryan Aug 23 '12 at 16:12

1 Answers1

0

Maybe these crystal reports syntax tips could help you (in the designer)

IsNull({Produits.Couleur})
InStr({Produits.Couleur}, " ") = 0

Some functions are build to have better formatting relative to context fields which are null:

PreviousIsNull, NextIsNull.

Some docs could help you like complete syntax reference for 8.5 (2011, pdf).

BendaThierry.com
  • 2,080
  • 1
  • 15
  • 17
  • `PreviousIsNull` and `NextIsNull` functions look at the previous and next _records_, not fields. In this case, knowing whether the previous or next address has a null ZIP field or not won't help you format the current address. – Ryan Aug 23 '12 at 15:27
  • Ok I will know :P It was looking to much promising :) – BendaThierry.com Aug 23 '12 at 19:16