Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal X - Summarizing in Subreports Post Reply Post New Topic
Author Message
jyalb
Newbie
Newbie


Joined: 27 Jul 2007
Online Status: Offline
Posts: 1
Quote jyalb Replybullet Topic: Crystal X - Summarizing in Subreports
    Posted: 27 Jul 2007 at 9:00am

I am new to Crystal Reports.  I have a report with 1 subreport.  In the main report I have a column that contains  "rated amts" and the subreport has a column with "paid amts".  I created a global currency variable formula that says if there is a paid amt use it, but if not then use the rated amt.  It works perfect!!!  The problem is I need to total that new column for each of my groups, and I can't figure out how.  I tried to use the sum function and place it in the group footer in my subreport, but it doesn't work.  I also tried using sum in the main report, but it only sums the "rated amts" because that is the global variable and the formula is in the subreport.  I don't know what to do.  Hopefully this makes some kind of sense and someone can help me out.

Thanks!!!
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 30 Jul 2007 at 7:07pm
Generally the way I do this kinds of things is create manual running totals.  Running totals as created in the Designer do not work with Formula Fields.
 
I would create  formula hdrAmounts and place it in the page header or group header as may be appropriate. I am not sure it you are trying to total one or two amounts but I would declare a shared variable for each one. In this example x and y.
 
It would look something like this:
-----------------------------
WhilePrintingRecords;
shared currencyvar x := 0;
shared currencyvar y :=0;
---------------------------------
Above I set each value at 0 so it resets to restart with each run of the page. You  suppress this formula.
 
In the detail section I create a formula called dtlAmount. In it your will need to create the logic for the variables.
 
It might look something like this:
-----------------------
WhilePrintingRecords;
shared currencyvar x;
shared currencyvar y;
 
If paidAmt <> 0 then x:= x + {paidamount_field}
else y:= y + (rateAmount_field};
y;
----------------------
You can suppress this formula unless you need it to show.
 
 
In the group footer create a third and final formula ftrAmount  that simply returns the variable or the sum of the two variables if needed.
 
It might look something like this:
--------------------------- 
WhilePrintingRecords;
shared currencyvar x ;
shared currencyvar y;
x := x+y;
x;
------------------------------
You need to clean up the logic on this but hopefully you will have enough information to get started.
 
You will find additional information in CR Help go to index look under "Running Totals - using formula section "  
 
Hope this is what you needed and that it helps.
 
Regards;
 
John W
 
 
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.