Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Posting of Monthly vs YTD Data in a Subreport Post Reply Post New Topic
Author Message
estfisher
Newbie
Newbie
Avatar

Joined: 24 May 2010
Location: United States
Online Status: Offline
Posts: 2
Quote estfisher Replybullet Topic: Posting of Monthly vs YTD Data in a Subreport
     Posted: 25 Aug 2010 at 8:32am
Hello Everyone,
 
I am not sure if this question had been asked (and answered) but I need your help.
 
I have been researching this forum to find a solution in posting figures that are in a monthly date range vs year-to-date range.
 
To make it clearer:
 
I am creating an expense report in which I am using three subreports.  They are linked to the main report using Subreport Link by the Business Code (Dept). 
 
My issue is that in the subreports, I have columns created specifically in showing monthly figures based on the date (month/year) picked and keep the YTD figures as is.
 
I thought that maybe I create a formula to capture the #s for the monthly date range and also to share the values of the Start and End Dates throughout the other subreports, here is a sample:
 
WhilePrintingRecords;
Shared DateVar Enter_Date;
Shared DateVar End_Date;
Shared CurrencyVar Month_Actual;
Enter_Date:= Date({@Month_Date});
End_Date:= Date({@Month_EndDate});
//Month Formula
if {ActualVsPlan.Expense_Date}>= Enter_Date and {ActualVsPlan.Expense_Date}<=End_Date
then
Month_Actual:={ActualVsPlan.mth_Actual};
Month_Actual
 
The problem that I am having is that data (and its totals) are the same as the YTD 's totals.
 
Please let me know what I am doing wrong.
 
If you need more information, please let me know.
 
Thank you.
Esther Fisher
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 25 Aug 2010 at 12:27pm
Instead of using a formula, try a running total.  You can set it to calculate for  Expense Dates that are only in your range of dates.
 
You have a couple of other options:
 
1.  Create a Stored Procedure that will provide both the Monthly and the YTD data in one call to the database.
 
2.  Create a single SQL Query that will provide both the Monthly and the YTD data in one call to the database and put it in a Command.
 
-Dell
IP IP Logged
estfisher
Newbie
Newbie
Avatar

Joined: 24 May 2010
Location: United States
Online Status: Offline
Posts: 2
Quote estfisher Replybullet Posted: 27 Aug 2010 at 10:43am
Thank you!  I will give it a try and let you know the outcome.
Esther Fisher
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