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

Suppress Blank Formula (Crystal)

Status
Not open for further replies.

HezMac

Programmer
Jan 14, 2004
56
CA
Hi There

I have a text box that I've dropped a database field and two formulas into:

Contact Name
@FormatPhone
@FormatFax

The problem is this: if the @FormatPhone is empty, it still leaves a blank, even when I click the Suppress Embedded Field Blank Lines option for the text box. (The phone has to be in a formula to be formatted as it's coming into the report as 10 digits.)

Breaking up the 3 fields isn't an option because there is information on either side of them.

I'm using Crystal 8.5.

Thanks very much for any suggestions! I hope that I've given enough information.

Cheers from Nova Scotia

Hez
 
Right Click on the Text Box.
Choose Format Text.
Under the Common Tab, click the X+2 button next to Suppress.
Enter the following in to the Editor:
Code:
{@FormatPhone} = ""
Save and Close and Test.

~Brian
 
Thanks for your suggestion, Brian.

Didn't work, though.

What I'd like to happen is if the @FormatPhone is null, then:

ContactName
@Format Fax

instead of what's happening now:

ContactName

@FormatFax

However, when I tried what you suggested, the whole text box was NOT suppressed, making me think that there is something being returned in the @FormatPhone anyway.

The @FormatPhone code looks like this:

// Format the work phone number
If Length(ToText({@WorkPhone})) = 7 Then
Picture(ToText({@WorkPhone}),"xxx-xxxx") + " Work"

Else If Length(ToText({@WorkPhone})) = 10 Then
Picture(ToText({@WorkPhone}),"(xxx) xxx-xxxx") + " Work"

Else If Length(ToText({@WorkPhone})) > 10 Then // includes extension
Picture(ToText({@WorkPhone}[1 to 10]),"(xxx) xxx-xxxx ")
+ " Ext. " + ToText({@WorkPhone})[11 to 16] + " Work"

Else If Length(ToText({@WorkPhone})) <= 1 Then
&quot;&quot;

Else
{@WorkPhone} + &quot; Work&quot;

Where @WorkPhone checks the descriptions that go along with the 10 digit numbers for &quot;Work&quot;.

Once again, thanks for any suggestions.

Hez
 
Why don't you just make a single formula instead of dropping 3 fields in a text box...much easier to control the output this way

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Sounds like a good idea, but what would be included in the single formula?

Hez
 
everything

//@Info

WhilePrintingRecords;
StringVar result := &quot;&quot;

If Not isnull({Table.contactname}) then
result := result + {Table.contactname} + chr(13);
...
add contents Phonenumber details (I would not use Picture here though
add contents Faxnumber details (I would not use Picture here though
...

result;

You give no details of your @workPhone formula so I cannot be detailed...but just add to the variable &quot;result&quot; and display at the end....do not use formulas within formulas as they have no good purpose and slow down the processing of the formula.

It is easy to control the nulls using this approach

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Thanks Jim...

I didn't do it exactly the way you suggested, but I did throw everything into one formula and it worked!

Thanks!

hez
 
Hi,
One advantage of using a text box is that you can format it to not show blanks lines if the field is null or empty.

Right-click the text box and choose Format Text..

There will be a check box the says 'supress embedded field
blank lines' - checking this will do exactly what you wanted to do in your original post.

[profile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top