Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Supress Subreport When Datatable Returns Same Result For All Records 1

Status
Not open for further replies.

brizaybrizoke

Technical User
Jul 21, 2011
25
US
Hello,

I am using CR 8.5 with a SQL DB.

I am printing invoices with a subreport for returning product.
I want to supress the subreport if all line items are FINAL SALE and print the subreport if not all items are FINAL SALE.

The datatable that returns as FINAL SALE or blank is ORDDET_STR
The lines items are ORDDET_LINE

How do I write a formula that will take into account all ORDDET_STR results based on ORDDET_LINE?

Thank you in advance!
 
The datatable that returns as FINAL SALE or blank is ORDDET_STR
The lines items are ORDDET_LINE

Set up a summary of ORDDET_LINE as an unique count. If the count is > 1 then you have things other than FINAL SALE and that can be used to print the sub report. If there are circumstances where there can be no FINAL SALE then set up a formula to count just FINAL SALES. If the formula is equal to the summary then all sales were final - suppress, if the formula is zero then no sales were final - print and if the formula and summary are both greater than zero then you had some of each - print. I think I got the combinations correct.
 
Sounds easy enough but I failed to mention that my details are in another subreport.

Is there a way that I can create these formulas below in the subreport with details,

\\FINAL SALE
if ORDDET_STR = 'FINAL SALE' then '1' else '0'

\\COUNT FINAL SALE
count({@FINAL SALE})

\\COUNT LINE ID
count({ORDDET_LINE})

And then pull this suppression formula, ({@COUNT LINE ID} = {@COUNT FINAL SALE}) into the Format Subreport Suppress settings via the main report?

Thank You!
 
Use a shared variable, link. IBM has Crystal help on their site.

Initialized the variable in a variable place on the main report header. Then place it in formulas in the sub-reports for either setting a value or checking one.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top