Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Sum no matter what?????? Post Reply Post New Topic
Author Message
Inieas
Newbie
Newbie


Joined: 25 May 2011
Online Status: Offline
Posts: 6
Quote Inieas Replybullet Topic: Sum no matter what??????
     Posted: 11 Jul 2011 at 10:37am
Hi All,

I hope someone could explain the following to me:

I have a table with the Colums:
Date
Amount
InOut

I managed to summarise the amounts according to the boolean InOut (1 or 0).

Now I have come across the following error:
If the table has the following:
Date                 Amount        InOut   Location
01.01.2010        500                1          A
01.01.2010        500                1          A
01.01.2010        2000              0          A

The result always comes back due to the 2 x 500 as 1500 and not 1000.

Does anyone know why and how to fix this problem.

Info and Code Used:
Amount:Currency
Date:Date
InOut:Boolean
Location: String

#RTotal1
Summarize: Amount
Evaluate Using Formula:
InOut = True
Reset On change of field :Location

#RTotal0
Summarize: Amount
Evaluate Using Frmula:
InOut = False
Reset On change of field :Location

@SumT
CurrencyVar SHT;
CurrencyVat SHO :=0;
CurrencyVar SHI := 0;

SHO := {#Rtotal1}
SHI:= {#RTotal2}
SHT := SHO-SHI
I hate struggling so bad!!!!!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Jul 2011 at 11:16am
#RTotal1
Summarize: Amount
Evaluate Using Formula:
InOut = True and previous(location)<>location
Reset On change of field :Location
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 12 Jul 2011 at 2:01am
the running total wizard doesnt always work properly
try manual running totals
 

MANUAL RUNNING TOTALS

 

RESET

The reset formula is placed in a group header report header to reset the summary to zero for each unique record it groups by.

 

whileprintingrecords;

                                                            Numbervar  X := 0;

 

CALCULATION

The calculation is placed adjacent to the field or formula that is being calculated.

(if there are duplicate values; create a group on the field that is being calculated on. If there are not duplicate records, the detail section is used.

 

whileprintingrecords;

                                                            Numbervar  X := x + {field}; ( or formula)

 

DISPLAY

The display is the sum of what is being calculated. This is placed in a group, page or report footer. (generally placed in the group footer of the group header where the reset is placed.)

whileprintingrecords;

                                                            Numbervar  X;

                                                            X

sharona
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jul 2011 at 5:04am
That is odd... I have never had an RT not calculate correctly.
I have had them give me expected values but that was because I designed it wrong not because it did not work properly. That is an issue with any type of RT or formula though.
I will have to watch for this.
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 12 Jul 2011 at 9:17am
depends on the version you are using. the older ones didnt work well, never had issues with the manual at all.
sharona
IP IP Logged
Inieas
Newbie
Newbie


Joined: 25 May 2011
Online Status: Offline
Posts: 6
Quote Inieas Replybullet Posted: 15 Jul 2011 at 1:45am
Hi and Thanks Alot for all the help but now I am stuck with a whole new thing if you dont mind helping!

I have created 3 Reports that work using the manual running total but need to insert them into another report as subreports that should
1. not be visible
2. Give me the Display value into the main report.

Anyone know how to do this using Crystal?


I hate struggling so bad!!!!!
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 15 Jul 2011 at 5:01am
you can use shared variables to pass the value from the sub to the main
make sure you dont surpress anything or the value wont be passed. make the fields small and white. and the sub as small as possible. place the shared variables below the sub.

SHARED VARIABLES

Shared variables are used to pass values from sub report to the main report.

(if you want  to summarize totals from a sub report with totals from the main report, you would use the following formulas to pass the value from the sub report to main report.

 

SUB REPORT                           whileprintingrecords;

                                                SHARED Numbervar  X := x + {field};

 

MAIN                                       whileprintingrecords;

                                                SHARED Numbervar  X;

                                                X

 

Shared variables can not be suppressed.

Make the font white and the field very small.

They must be placed below the subreport to retrieve the value.

sharona
IP IP Logged
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