Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Looping Post Reply Post New Topic
Author Message
HelenH
Newbie
Newbie
Avatar

Joined: 21 Apr 2010
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote HelenH Replybullet Topic: Looping
     Posted: 08 Jul 2010 at 1:25am
I have a report that print sticky labels, with a parameter of "How many labels do you want?"
 
I want to print the same label the number of times in the parameter.
 
How do I make it loop round to do this?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 08 Jul 2010 at 3:11am
best what that I have heard to do this is to join to a table of numbers...just 1,2,3,4,5,6... and in the where clause set it to numbers.index <= @parameter...numbers is a table name and index is the column...just to make sure, since I am not referencing a real table.  You can join the table probably as a 'cross join' so that you get the cartesian product...which is what you are after.
 
HTH
IP IP Logged
HelenH
Newbie
Newbie
Avatar

Joined: 21 Apr 2010
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote HelenH Replybullet Posted: 08 Jul 2010 at 3:23am
I think I actually need something like a "Do While", but don't know how to code it into the report
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 08 Jul 2010 at 3:36am
CR won't print multiple labels in a loop.  CR basically prints 1 line per row of data...so what you need to do is to multiply the number of lines of data, and then CR will be happy to print them.
 
I am guessing that you could set the field to grow and keep adding to the field, but the sizing is going to be difficult as CR doesn't have much control over that.  Also since I have never printed labels, I don't know how CR formats them...which goes back to the sizing issue.
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 08 Jul 2010 at 3:59am
Hi  Helen
 
Try the following

 
*The Main Table which has all the data will have Label Nos I assume.
*So  create a another Table call Repeater Table with one column to store the labelno and just repeat them depending on the number of times you want to repeat the label in the report.
e.g. if you want label 1 to be repeated 2 times enter 1 in repeater table 2 times.
 
* Then in Crystal Reports select both the tables Main Table and Repeater Table but don't join them.
* Then Create a Parameter (Dynamic) which selects the Label No field from Main Table
*Then in record selection formula  check for
{RepeaterTable.LabelFieldNo} = {?ParameterName}
*That's all
 
Hope this what you looking for


Edited by rahulwalawalkar - 08 Jul 2010 at 4:00am
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