Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Subreport Data Post Reply Post New Topic
Author Message
avaj
Newbie
Newbie


Joined: 26 Sep 2007
Online Status: Offline
Posts: 30
Quote avaj Replybullet Topic: Subreport Data
    Posted: 07 Nov 2007 at 1:12pm
Hi all, I am having trouble getting the correct data picked up by my subreport.  Here is an example of what my report should look like:
 
Main:
Sub Category - Cash
   Acct 1  
        Tkt A    20  $50
        Tkt B    10   $4
        Tkt C    30  $45
   Acct 2
        Tkt A    5     $10
        Tkt C    2     $20
 
SubReport:
Sub Category - Cash
     Tkt A     25    $60
     Tkt B     10    $4
     Tkt C     32    $65
 
There are several parameters the user can enter to limit the data.  In my Subreport I have tried the following Record Selection formula:

{VENDOR_SALES.ORDER_DATE}  >= {?Pm-@From Date} and

{VENDOR_SALES.ORDER_DATE}  <= {?Pm-@To Date} and

{VENDOR_SALES.UNIT_SOLD} > 0.00 and

{VENDOR_ACCOUNT.SUFFIX} = 0.00 and

{VENDOR_ACCOUNT.SUB_CATEGORY} = {?Pm-VENDOR_ACCOUNT.SUB_CATEGORY}

 
This works correctly when the parms are left to the default for all records.
 
The problem is when I try to include the other optional parms.  I can only get it to work for one or the other scenario.  For example if the user only wants to see Acct 1, the Subreport should only show Acct 1 info.  Also, I have 2 other optional parms that need to be included too.
 
I have tried:

({VENDOR_SALES.ORDER_DATE}  >= {?Pm-@From Date} and

{VENDOR_SALES.ORDER_DATE}  <= {?Pm-@To Date} and

{VENDOR_SALES.UNIT_SOLD} > 0.00 and

{VENDOR_ACCOUNT.SUFFIX} = 0.00 and

{VENDOR_ACCOUNT.SUB_CATEGORY} = {?Pm-VENDOR_ACCOUNT.SUB_CATEGORY})

or

({VENDOR_SALES.ORDER_DATE}  >= {?Pm-@From Date} and

{VENDOR_SALES.ORDER_DATE}  <= {?Pm-@To Date} and

{VENDOR_SALES.UNIT_SOLD} > 0.00 and

{VENDOR_ACCOUNT.SUFFIX} = 0.00 and

{VENDOR_ACCOUNT.SUB_CATEGORY} = {?Pm-VENDOR_ACCOUNT.SUB_CATEGORY} and

{VENDOR_ACCOUNT.ACCT_ID} = {?Pm-VENDOR_ACCOUNT.ACCT_ID})

This one works correctly when the parms are left to default for all records but it does not limit the data in the subreport when I only want a specific acct.  If I use just the second part of the formula (the section after the OR), it works correctly for a specific acct but not for all records.

I have tried reversing the order to no avail.
So I need a way to combine all the possible scenarios in one record selection.  I also tried just using the Subreport Link section but that by itself did not give me what I want either.
 
Hopefully this makes sense and somebody can offer a suggestion.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 07 Nov 2007 at 1:49pm
I'm a little confused by the exact details in this post, but I think I get the general idea. I would try putting a double condition on the acct_id to test for the existence of the default value in the parameter or filter using a single record only. Something like this:

{VENDOR_SALES.ORDER_DATE}  >= {?Pm-@From Date} and

{VENDOR_SALES.ORDER_DATE}  <= {?Pm-@To Date} and

{VENDOR_SALES.UNIT_SOLD} > 0.00 and

{VENDOR_ACCOUNT.SUFFIX} = 0.00 and

{VENDOR_ACCOUNT.SUB_CATEGORY} = {?Pm-VENDOR_ACCOUNT.SUB_CATEGORY} and

({?Pm-VENDOR_ACCOUNT.ACCT_ID} = defalut value or

{VENDOR_ACCOUNT.ACCT_ID} = {?Pm-VENDOR_ACCOUNT.ACCT_ID})


Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
avaj
Newbie
Newbie


Joined: 26 Sep 2007
Online Status: Offline
Posts: 30
Quote avaj Replybullet Posted: 08 Nov 2007 at 7:51am
That's it!!!  Thanks a million Smile
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.