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

Suppressing / not showing 0 values

Status
Not open for further replies.

KBChristy

IS-IT--Management
Sep 3, 2002
32
0
0
GB
I have 3 columns of data. I do not want the line to show if all 3 columns have a zero value.

Example: Stock record1 0 0 0
Stock record2 6 0 0

I do not want stock record1 to appear.

How do I do this please?
Thank you!


 
if they are in the details section....

in the Section expert type in the X-2 of Suppress....


field1=0 and field2=0 and field3=0

 
Better yet, exclude them from the report with a record selection formula.

Suppressing the line can be dangerous, as it will still evaluate in any summary operations such as a COUNT or a SUM. A zero will not mess up a SUM, but it will get in the way of a COUNT.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
As dgillz alluded to, eliminate them by using something like:

Select Report->Edit Selection Formula->Record

({table.val1} <> 0
and
{table.val2} <> 0
and
{table.val2} <> 0)

-k
 
Create a formula {@RecordSum}:

{Col1}+{Col2}+{Col3}

Then go to Edit Selection Formula->Group and enter:

{@RecordSum} > 0

-LB
 
If some of the values of the 3 colums were negative, and the sum netted to zero, this would not make it through to the report. I am not sure that is what is wanted.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
Precisely, dgillz.

Omit the formula, just reference the fields directly in the record selection formula with explicitly zero checks.

-k
 
I see your point, although there was no indication that the fields could be negative. Then how about for {@RecordSum}:

abs({Col1})+abs({Col2})+abs({Col3})

and a group select of:

{@RecordSum} > 0

Maybe I'm being dense here, but I think that SV's solution will only return records where all three columns are not equal zero, when the request is to eliminate a row only if all three ARE equal zero.

I think Checkai's suppression formula would work though also.

-LB
 
LB: The post states: &quot;if all 3 columns have a zero value.&quot;

So check for all three columns having a zero value, not the sum of all 3 being zero.

It may be that there aren't any negative values, I was just trying to be thorough, perhaps with overkill.

Keep in mind that I also try to pass everything to the database for processing, hence I generqally explicitly define things to help with this.

-k
 
Well, I think you've missed my point. I think using a record select that says all three columns <> 0 will eliminate rows where one or two are = 0. If data looks like this, I think your record select will return only Row 2, when Rows 1 to 3 should be returned:

Row 1: 0 2 3
Row 2: 2 3 4
Row 3: 0 0 2
Row 4: 0 0 0

-LB
 
lbass,

Synapse's formula:

({table.val1} <> 0
and
{table.val2} <> 0
and
{table.val2} <> 0)


would eliminate only record 4 from your example, becuase only record #4 has column 1 <>0 AND column2 <> AND columns 3<>0.

The scenarion you are describing would only occur if the operator had been OR instead of AND

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
I was willing to believe I was wrong, but tested this, and the only record returned in my example was Row 2. The parentheses add nothing to this record select statement--the record select will only return those values not equal to zero for each field.

-LB
 
Lbass,

My apologies, it was I that had the AND and OR switched.

Using OR is the way to go. AND would only show row 2.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
Lbass is correct...OR is the proper syntax

LBass - I think using the record to eliminate unwanted data rather than your original formula is the better way to go. Not so much because of the potential problems from adding negative numbers but more to the point of slowing down the report by bringing in unwanted data to be processed.

Jim Broadbent
 
Thanks, guys, and I do agree that using &quot;or&quot; between the three fields is a better solution than I originally proposed.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top