• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7679
  • Last Modified:

crystal reports repeat section

Hi, I am using crystal report 10. I am wondering if we can set selected section to be printed multiple times. for example, user will input a integer to a parameter field. If the user input 3, I would like detail section to be printed 3 times.  thank you very much
0
rickchan108
Asked:
rickchan108
  • 4
  • 3
  • 2
  • +1
1 Solution
 
MOA81Commented:
this section you want to reprint

does it have a limit of printing times lets say ten for ex?

is it one line or multiples?
0
 
rickchan108Author Commented:
the limit only depends on the number that user input. but I believe it wouldn't be a large number. might be around 20-30.

The section contains 3-4 lines


thank you very much
0
 
frodomanCommented:
No, you cannot have a section repeat X number of times however there are two other approaches that will work:

#1)  Insert 30 additional detail sections and copy the same fields / layout / etc. into each section.  Conditionally suppress each section based on the user parameter entered.  For example, the 15th section would be conditionally suppressed with this formula:  ({?UserParam} < 15)   etc...

#2)  Create a database table that contains just a sequence of numbers (1, 2, 3, 4, ...).  Include this table on your report without joining it to any of your other tables.  Use the select expert to limit the records used from this table:  {Table.Numberfield} <= {?UserParam}       Because this table isn't linked, it will produce a cartesian join - essentially repeating everything in your details section once for each record that is pulled in.


#1 is much more difficult to maintain because you have to repeat changes 30+ times.  It also gets unweildy when the number gets larger than 30 or so.  #2 is easier to maintain but it does actually replicate the records so if you're doing summary totals they will be distorted.  You can account for it by dividing totals by {?UserParam} but it's another detail to take care of.

hth

frodoman
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
MOA81Commented:
actually thats why asked about the limit for the same reason frodoman mentioned in solution #1

but that seems hell of a job

0
 
frodomanCommented:
Oh yes, it a a *lot* of work.

I always advise #2 as being a far more reasonable solution but I often run into people that don't have the ability to add tables to the DB so #1 is their only choice...

frodoman
0
 
rickchan108Author Commented:
#1 is probably work for me.

I don't quite understand #2. it is mentioned everything in your details section repeat once for each record that is pulled in. why would it repeat once? what if user input 5 as parameter value, would it still repeat once only

thank you
0
 
frodomanCommented:
#2 would repeat once for every record in the numeric table.  If you enter a parameter of 5, you will have the numeric table filtered in the select expert as {Table.NumberField} <= {?Parameter} so you would get the records 1,2,3,4,5 from the numeric table.

The way SQL works, if you have table that are not joined explicitly, the SQL engine will join every record with every other records (known as a cartesian join).  Usually this is not the desired behavior but in some cases it does work to your advantage.  In this case, it would join 1,2,3,4,& 5 to each of your existing records in your main table - effectively creating 5 copies of every record in your main table...

If #1 works for you and you understand it better than by all means go for it.  Keep #2 in mind if you ever need to do something more like 100 copies where it becomes impractical to create a large number of detail sections.

frodoman
0
 
rickchan108Author Commented:
sounds like #1 is easier if I understand the concept. I will keep in mind

thanks for helping
0
 
frodomanCommented:
Glad to help.
0
 
muthuCommented:
i am new to crystal report i want to display several lines in a  detail section,it may be a single line or a several pages how can i display
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now