Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Printing multiple reports Post Reply Post New Topic
Page  of 2 Next >>
Author Message
abhi81
Newbie
Newbie


Joined: 11 Jan 2007
Location: Canada
Online Status: Offline
Posts: 38
Quote abhi81 Replybullet Topic: Printing multiple reports
    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.

IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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>
IP IP Logged
abhi81
Newbie
Newbie


Joined: 11 Jan 2007
Location: Canada
Online Status: Offline
Posts: 38
Quote abhi81 Replybullet 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.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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>
IP IP Logged
abhi81
Newbie
Newbie


Joined: 11 Jan 2007
Location: Canada
Online Status: Offline
Posts: 38
Quote abhi81 Replybullet 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!!!
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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>
IP IP Logged
abhi81
Newbie
Newbie


Joined: 11 Jan 2007
Location: Canada
Online Status: Offline
Posts: 38
Quote abhi81 Replybullet 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?
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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>
IP IP Logged
abhi81
Newbie
Newbie


Joined: 11 Jan 2007
Location: Canada
Online Status: Offline
Posts: 38
Quote abhi81 Replybullet 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?
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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>
IP IP Logged
Page  of 2 Next >>
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.031 seconds.