Suppress Detail not working (1 Viewer)

RenaG

Registered User.
Local time
Yesterday, 23:16
Joined
Mar 29, 2011
Messages
166
I am trying to suppress the detail line on my report but nothing I have tried has worked.

There is a field on my report called @Results 2 which looks like this:

Code:
[COLOR=#17365d][COLOR=#17365d]If {Observe.Obs_Float} <> 0 Then[/COLOR]
[COLOR=#17365d]   CStr ({Observe.Obs_Float})[/COLOR]
[COLOR=#17365d]Else[/COLOR]
[COLOR=#17365d]If {Observe.Obs_Choice} <> 0 Then[/COLOR]
[COLOR=#17365d]   CStr ({Observe.Obs_Choice})[/COLOR]
[COLOR=#17365d]Else[/COLOR]
[COLOR=#17365d]If {Observe.Obs_String} <> ' ' Then[/COLOR]
[COLOR=#17365d]   {Observe.Obs_String};[/COLOR]
[/COLOR]
I want to suppress lines that have a space in the @Results 2 field. I have tried putting this in the conditional suppress:
Code:
[COLOR=#17365d][COLOR=#17365d]{%Results 2} = ' ';[/COLOR]
[/COLOR]
That didn’t work.

So I created another field called @SetUpDSuppress to do this:
Code:
[COLOR=#17365d][COLOR=#17365d]NumberVar ShowDetails;[/COLOR]
 
[COLOR=#17365d]EvaluateAfter ({@results 2});[/COLOR]
[COLOR=#17365d]If {@results 2} = ' ' Then[/COLOR]
[COLOR=#17365d]   ShowDetails := 0[/COLOR]
[COLOR=#17365d]Else[/COLOR]
[COLOR=#17365d]   ShowDetails := 1;[/COLOR]
[/COLOR]
I put it on the Detail line (and it works). In the conditional suppress on the detail line:
Code:
[COLOR=#17365d][COLOR=#17365d]NumberVar ShowDetails;[/COLOR]
[COLOR=#17365d]ShowDetails := 0[/COLOR]
[/COLOR]
That didn’t work either.

I am guessing it has to do with when things are being evaluated but not sure how to control it. Any suggestions?
 

boblarson

Smeghead
Local time
Yesterday, 22:16
Joined
Jan 12, 2001
Messages
32,059
Look into using the Instr function if you want to surpress if there is a space.

Also, you should be using double quotes and not single quotes for checking

And don't give your objects spaces in the names. Make it Results2 and not Results 2.

And so if it has no space in the name (like it shouldn't):

Code:
@Results2 = " "
 

RenaG

Registered User.
Local time
Yesterday, 23:16
Joined
Mar 29, 2011
Messages
166
Hi Bob,

I totally agree with you about not creating objects with spaces in the name. I inherited this report :rolleyes:. At this point I am still figuring out how it works and I don't want to take the chance of breaking it by renaming the formula.

That being said, I tried the InStr function in the conditional suppress:
Code:
InStr ({%Results 2}, " ") <> 0;
It still doesn't work correctly.
 

boblarson

Smeghead
Local time
Yesterday, 22:16
Joined
Jan 12, 2001
Messages
32,059
Okay, is Results 2 a function? If so it should be

@Results 2

and not

%Results 2


and I'm not sure but with the space in the name you might need square brackets or single quotes:

@[Results 2]

or
[@Results 2]

or

@'Results 2'

(it has been four years since I've been in Crystal Reports, although it is my favorite report writer, so I am a little rusty at a few things and I don't have anything to play with in order to try various things out)
 

RenaG

Registered User.
Local time
Yesterday, 23:16
Joined
Mar 29, 2011
Messages
166
Oh brother!!! :eek:

That's it.

I changed the % to a @ and it works. I took out the InStr and it still works.
Code:
{@Results 2} = " ";

There is also a SQL Expression Field called Results 2 and I got them mixed up (the SQL Expressions Fields are referenced with a %).

I am rusty on my Crystal too; back in the saddle so to speak after several years of not using it. It's been fun using it again.

Thanks for all your help!
 

Users who are viewing this thread

Top Bottom