Print Page | Close Window

Printing multiple reports

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=114
Printed Date: 19 May 2024 at 2:56pm


Topic: Printing multiple reports
Posted By: abhi81
Subject: Printing multiple reports
Date Posted: 11 Jan 2007 at 6:25pm

Hello All,
I want to fire reports based on the series of order numbers. I know i can use reportselectionformula to fire report on a single order number but how do i handle this if there is a requirement to print 50 order numbers at one time, i.e., 50 order numbers are passed as arguments and all the order numbers should be ready to print.

Thanks in advance.




Replies:
Posted By: BrianBischof
Date Posted: 12 Jan 2007 at 12:36am
You can create a comma delimited string of all the order numbers and then customize the selection formula to test if the current order number is in the list. This is going to have to be done using some programming code like VB.NET or C#.

-------------
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>


Posted By: abhi81
Date Posted: 12 Jan 2007 at 7:27am
Hello Brian,
Thanks for ur reply. I tried that but what happens now is that it only prints the last order number. My code is in vbscript as follows:
 
ordno="10000,10001,10002"
dim param
param=split(ordno,",")
i=ubound(param)
for j=0 to i 
  Session("oRpt").RecordSelectionFormula = "{ReportView1.order_num}="
  &cint(param(j) )
next
 
Basically now what i want is this. When the user hit the print button the report viewer should have like 3 pages of report 1 for each order number so that all these invoices can be sent to the printer for printing.


Posted By: BrianBischof
Date Posted: 12 Jan 2007 at 8:54am
Cool, you're close. But after building the string of values, don't split it up. Instead, use the array IN function to test if the order_num field is in the list. Something like this...


ordno="10000,10001,10002"
Session("oRpt").RecordSelectionFormula="{ReportView1.order_num} IN [" & ordno & "]"


If I screwed up this syntax, just go into the record selection expert and build the formula there. Then look at the exact syntax to make sure your formula looks the same as the one Crystal Reports created in the expert dialog box.


-------------
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>


Posted By: abhi81
Date Posted: 12 Jan 2007 at 9:42am
Hi Brian,
Thanks for ur quick response. the syntax u provided was absolutely correct but it still didn't solve my problem.
The selection formula changed to
{ReportView1.order_num} IN ["10000","10001","10002"] but it still shows only the first one,i.e., 10000 in the report viewer.
 
I wanted to have 3 pages(invoice reports) 1 for each order number that was provided in the list at the same time. I know it is possible but am not able to figure out a way to do this.
 
Please help!!!


Posted By: BrianBischof
Date Posted: 12 Jan 2007 at 11:11am
Hmmm, well there is something else happening behind the scenes then. The first thing I do in situations like this is get the report working WITHOUT programming code mucking things up.

1) Just open your report in the designer and preview it. No code. Then modify the record selection formula and keep working with it till it gives you three pages.

2) Once you get the report printing three pages, then look at the syntax of the record selection formula and this will tell you exactly what it wants to see for it to print the three pages (I asssume it will look very similar to what we are doing). Copy the full formula to Notepad or something and delete it from the report (so that you will know when it starts work again).

3) Once you have that working, then copy this formula to your proramming code and paste it in there EXACTLY (as a single text string). Don't change a single character. Make sure that works. If it doesn't, then there is a problem with how you are modifying the recordselectionformula property.

4) Once you have that working, then modify the programming code so that it is dynamic and prints whatever the user wants.

By breaking down each step in a systematic way, you can determine at what point there is a problem. Then start your debugging there. Otherwise, you might spend all day working on the perfect formula only to find out that this wasn't the problem at all and instead CR.NET wasn't passing the formula to CR properly.


-------------
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>


Posted By: abhi81
Date Posted: 13 Jan 2007 at 10:38am
Hello Brian,
After trying a lot of different things(all the different possible combinations in the select expert) i am still not able to achieve the result i wanted.
 
Let me ask you this..... i have 2 tables on the report say tableA(order_num as pk) and tableB(order_num as fk). I am using fields from tableA and tableB based on order_num provided to the report.
 
You already know what i want, i.e.,have 3 reports(3 separate pages) fire based on order_num provided as the parameter at same time.
 
Is this possible to do in Crystal report.....as i have already tried a lot of things being unsuccessful?


Posted By: BrianBischof
Date Posted: 13 Jan 2007 at 1:50pm
Yes, it is possible. I think you are probably just missing one of the pieces and not realizing it. In the four steps I gave you, which one isn't working for you?

-------------
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>


Posted By: abhi81
Date Posted: 14 Jan 2007 at 8:29am

Out of the 4 steps provided by you i am not able to get the desired result out of step1 which stands as the base of all the other steps, that was

1) Just open your report in the designer and preview it. No code. Then modify the record selection formula and keep working with it till it gives you three pages.

I opened the report in the designer and played around with the selection formula but if it is possible to achieve what i want it could be that the formulas i am trying are all incorrect. i tried options with "in","is one of","is between","is like" and even tried to create my own using case structure but nothing seems to be working.
 
One more thing if that is important. My primary key(order_num) is in the page header and the details from the child table are in the details section.
 
Can you please guide me to a working formula that i should be using in such scenario?


Posted By: BrianBischof
Date Posted: 14 Jan 2007 at 2:44pm
Hmmm, well if step 1 isn't working, then something fundamental is going wrong somewhere else. From a record selection standpoint, you should be able to get SOMETHING to filter properly. It sounds like no filter works whatsoever. I'm at a loss for what to suggest where the problem might be otherwise.

-------------
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>


Posted By: hilfy
Date Posted: 15 Jan 2007 at 12:11pm

Does your report give only one page for each order, or is it multiple pages?  If it's multiple pages, there's no way I know of to display just the first page for each order - the viewer will show all of the pages for an order and then move to the next order in the list.

Is your order number a field in the database or a formula?
 
Does the report work when you have no order number selection criteria? 

If so, then use the Select Expert  to select the order number field "Is one of" and then add several order numbers, one at a time.  Does the preview give you what you expect?  If so, look at the selection formula that was generated and use that syntax to set up the select from your application. 

This was what Brian was telling you to do, but you must start completely without the order number part of your selection criteria to make sure that the report itself is working correctly.

-Dell



-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: abhi81
Date Posted: 15 Jan 2007 at 12:57pm

Thanks Brian and hilfy,

I think i will be able to do what i wanted to. I had to change the design and it seems to be working ok. Only a few minor changes required. At the end of each report I want to insert a blank page with the new order number and reset the page number before inserting the blank page. I know there is property Reset page number after but i haven't used it before.
 
 
Also I had create Group header #1b to put in the text objects acting as a header for each field in the detail section. I want to suppress this group if there are no more records for order details. How can achive this? I am sure it must be possible.


Posted By: hilfy
Date Posted: 15 Jan 2007 at 1:00pm
On the section, put a suppress formula of "IsNull({detail field})" where "detail field" is the field that identifies an order detail.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: abhi81
Date Posted: 15 Jan 2007 at 1:44pm
Thanks Hilfy,
I was able to suppress the section as desired using the concept of pagenumber but i tried your suggestion and that works too.
 
You did not make any notes on my other question that was:
"At the end of each report I want to insert a blank page with the new order number and reset the page number before inserting the blank page. I know there is property Reset page number after but i haven't used it before."
 
Could you please shed some light on it as well.


Posted By: hilfy
Date Posted: 15 Jan 2007 at 1:51pm

Format the footer section for the group, and turn on Reset Page Number After.

Create a new header section for the Order Number group.  Make it the first header section for the group.  Put on it the information that you want to have appear on the "blank page".  Format the section and check "New Page After".  If you want the rest of the order information to start at Page 1, you'll also check "Reset Page Number After".
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window