Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: supress if zero Post Reply Post New Topic
Page  of 2 Next >>
Author Message
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Topic: supress if zero
     Posted: 13 Sep 2013 at 2:23am
I have a GL report that adds up credits and debits. It's working and the numbers all look good. The layout is good but for some reason I'm getting 3 random 0's that show up.

I have suppress if zero checked on in the report and sub report and i'm not sure why these zero's are still showing. Is there a trick to it or something I may not be thinking of.

for example I'm getting something like this

credit    |   debit
                418.29
0              29.15
356.10  | 0
             |  10
0           | 100
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Sep 2013 at 3:44am
likely is it not zero bit rather something like .00001
try and round it to 2 decimals and suppress that =0
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 13 Sep 2013 at 3:51am
well, i thought that might be the case so i have already done that. i went through and removed any "Else 0;" statements and I'm still getting random zeros. to me it's not really a big deal but the import cannot have zeros and I can't figure out what it is. The report zero's out also as a GL should which makes it a bit more odd that the zeros showing are random. 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Sep 2013 at 3:54am
what kind of values are they? RT's, summary fields?
Are they in headers, details , footers?
Subreport values?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Sep 2013 at 3:59am
also you can test it by adding a formula to see how the piece of data is being read to try and troubleshoot.
//test
summaryfield = 0
what does it return? true or false?
if false change it to
summaryfield in 0 to 1
now is it true or false?
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 13 Sep 2013 at 3:59am
They are sum fields of credits and debits coming from 2 sub reports.

1 sub report for invoices and 1 for checks. they are being displayed in the main reports footer record.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Sep 2013 at 4:07am
so the formula field is
sharedvariable1+sharedvariable2
with a suppression formula as what?
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 13 Sep 2013 at 4:19am
so i fixed it up a bit and found a spot that the logic was off but i'm still getting 1 zero using this formula. "format" is a variable that allows for user input so it's checking if the user entered "Number"

If format = "NUMBER" Then
(
    If Debit = 0 Then
        sOutput := ""
    Else
        If Debit > Credit Then
              sOutput:= toText(Debit - Credit, 2,"")
        Else
            sOutput := ""; //removed zero
        isTextField := FALSE;
               
);

and it returns this

144823.62
1256.07
0


so it looks like i'm still getting this random 0 thing.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Sep 2013 at 4:30am

totext does sort of round but you are not rounding in your if calculation.

try this but i warn you that it might give you the output you want it still does not explain the result that is less than a penny
 
If format = "NUMBER" Then
(
    If round(Debit,2) = 0 Then
        sOutput := ""
    Else
        If round(Debit,2) > round(Credit,2) Then
              sOutput:= toText(Debit - Credit, 2,"")
        Else
            sOutput := ""; //removed zero
        isTextField := FALSE;
               
);
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 13 Sep 2013 at 4:31am
for suppression i'm just using format field and suppress if zero. on the subreport i just went to suppress formula

if {field1} or {field2} = 0 then true else false
IP IP Logged
Page  of 2 Next >>
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum