Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Sub Reports! Post Reply Post New Topic
Author Message
celts12289
Newbie
Newbie


Joined: 22 Aug 2011
Online Status: Offline
Posts: 2
Quote celts12289 Replybullet Topic: Sub Reports!
     Posted: 22 Aug 2011 at 12:53pm
Is it possible to add or subtract data from to separate sub reports?  Here is my set up:

Main report shows:

Column 1 = Technician names
Column 2 = Sub Report 1 (shows total number of orders tech has, linked by Employee ID to the main report.)
Column 3 = Sub Report 2 (shows total number of units the tech has on hand, linked by Employee ID.)

Main report parameters are showing all technicians that the "fire date" is null, Employee Type is equal to "T" for technician.

Now the reason I have to do sub reports is because I can't get the totals without using them because when I do the report just blows up and I get crazy data!

So what I'm trying to do is have the report subtract the number shown from Sub Report 1 (which is a summary count of work orders) from Sub Report 2 (which is a summary count of units)? 

Is this possible or am I pulling out my hair for no reason?

IP IP Logged
Annette
Newbie
Newbie


Joined: 25 Jul 2011
Online Status: Offline
Posts: 13
Quote Annette Replybullet Posted: 23 Aug 2011 at 1:32am
Hello,


If you want to use a field from a sub report in the main report either in a formula or in the report itself then you must declare a variable in the subreport first

e.g.

Formula Item Count in Sub Report which contained the items of the contract:-

WhilePrintingRecords;

Shared NumberVar iItemCount;

If ({CONTITEMS.SAFEFLAG} = false or {CONTITEMS.TYPE} = 5 or {CONTITEMS.PARITEM}<>{?Pm-CONTITEMS.RECID}) = false then

    iItemCount := iItemCount + 1

Then you can create a formula in the main report using the variable or just to print the variable on the report

e.g.

Formula ItemCount in the Main Report:-

Shared NumberVar iItemCount;

iItemCount


Hope this helps..
IP IP Logged
celts12289
Newbie
Newbie


Joined: 22 Aug 2011
Online Status: Offline
Posts: 2
Quote celts12289 Replybullet Posted: 23 Aug 2011 at 8:49am
Thank you so much!  This was a tremendous help!  I ran into a few other problems but that is more with my companies data bases that are a complete mess! 

Either way you've pointed me in the right direction and from there I was able to get it done!  Thank you again!
IP IP Logged
Annette
Newbie
Newbie


Joined: 25 Jul 2011
Online Status: Offline
Posts: 13
Quote Annette Replybullet Posted: 23 Aug 2011 at 8:58am
No problem, glad to be of help
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