Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Supress Sub-Report based on external data Post Reply Post New Topic
Author Message
mbailey
Newbie
Newbie
Avatar

Joined: 11 Apr 2009
Online Status: Offline
Posts: 2
Quote mbailey Replybullet Topic: Supress Sub-Report based on external data
     Posted: 28 Mar 2012 at 4:01am

I'm using CR 11.  I need to figure out how to suppress a sub-report based on data contained in another table not part of the data set used for the reports.
Situation is we have a shipping application that maintains its own data, and when an order is shipped, it automatically prints a packing slip for the order. We have about 500+ customers that also require us to include an invoice in the box when it ships.  Currently, each of these customers must  be configured, one at a time, to also print the invoice. Both reports are CR reports.  I’ve created a SQL table with the customer number of each customer that needs the invoice.  What I want to do is embed the invoice in the packing slip report as a sub-report, and suppress it unless the customer number is in my table. The customer number is a parameter in their report, so I would like to something like:

Suppress If {?custno} not in (select custno from dbo.include_invoice)

Not sure if this can be done, or what the proper syntax would be if you can.  The report does not have access to this table by default, but I could join it in I suppose if necessary.

Thanks,

Mike Bailey

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Mar 2012 at 4:09am
if you add the table and do an outer join on it to your current data set you can conditionally suppress the subreport using
NOT(isnull(include_invoice.custno))


Edited by DBlank - 28 Mar 2012 at 4:10am
IP IP Logged
mbailey
Newbie
Newbie
Avatar

Joined: 11 Apr 2009
Online Status: Offline
Posts: 2
Quote mbailey Replybullet Posted: 28 Mar 2012 at 7:24am
Thanks for the quick reply!

I assume I'd have to put the custno parameter in there:

NOT(isnull(include_invoice.{?custno}))

Is that correct?

Mike
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Mar 2012 at 7:41am

if i understand correctly you would not.

What is the {?custno} param for in the regular report.
I assumed it was to to limit the data set for which packing slips to be printed. If it is only used for suprpession of the invloice records i do not think you need it at all.
 
My suggestion was to use the include_invoice table in your data set with an outer join .
NOw you shyould have a full data et with  two custno's.
iclude_invoice.custno will be NULL whenever the record  has not been printed yet.
if my understanding is accurate then after you alter your data set by outer joining in the inlcude_invoice table 
NOT(isnull(include_invoice.custno))
is the same as your desired
{?custno} not in (select custno from dbo.include_invoice)
 
Did I get part of your requirements incorrect?
 include_invoice.custno is not null it is the same thing as your original statement of
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