Print Multiple Copies of Record Crystal Reports - crystal-reports

I have a report that is only one record, however, the user specifies how many times it needs printed, let's say 10. Each time it prints it prints 4 of the same report. Like this, Page 1 x 4, Page 2 x 4, Page 3 x 4, etc. With 10 copes their will be 40 pages altogether.
Update:
I was able to get all the pages I needed based on the values the user inputs. So if there are 10 pallets I have 40 pages of labels, which is correct. Now the control number part that needs to be displayed. It is kind of like a page number but every 4 pages the number needs to increment by 1. I assume I can use WhilePrinterRecords and some how increment, but I am still new to Crystal and unfamiliar with it.
Example:
Page 1: Control number 1
Page 2: Control number 1
Page 3: Control number 1
Page 4: Control number 1
Page 5: Control number 2
Page 6: Control number 2
Page 7: Control number 2
Page 8: Control number 2
This would continue until there is no more pages to print.

if you want 4 copies for each label, what you could do is create 4 sections on the report with the same info. Make sure that you assign the label size to each page(e.g. 4x6). e.g. if you have that info on your header, create PHa, PHb, PHc and PHd, same for details or PF.
don't know if this could work for you, but at least is a recommendation. You can create suppressed sections with the same info(e.g. 10 sections) and create a parameter that control that suppress condition defaulted in 4. If the user what to print 5, it will enable section 5th, same if want to print 3 it will suppress the 4th.
Upadte: how to get the increment:
place a formula on your page footer like below one. It will return value when gets an integer and suppress it when is equal to 0(right click on it, number tab, customize, suppress if 0).
if pagenumber = Ceiling(pageNumber,4) then numbervar page := page +1
then place another formula on your PF as well like below one and suppress it when pagenumber = Ceiling(pageNumber,4) so it won't show when the other has value and put one overlapping the other to get the value in the same place.
if {1st formula} <> 0 then numbervar page1 := {1st formula};
page1 + 1
2nd Update:
Because is a label and your details are acting as a new page do this:
create a new detail section, so you will have details a and b and place your formulas on details b

I have used additional tables for such tricks; these tables must be linked to report to multiply main query results. Some care has to be taken to not allow multiple users printouts to mix.
Example, assuming your report query has some unique id to link and your user/session has also some unique id:
you create table cr_special(reportid int, userid int, ctlnumber int)
you design report, linked to this table by reportid and filtered by userid; changing ctlnumber field is taken from your special table
before printing, you delete all records with reportid/userid combo and insert new ones
you print report, giving userid as parameter
Say you want to print 10 reports with increasing numbers - then you insert 10 records into your special table with ctlnumber increasing from 1 to 10.
Variation of this solution is to use some other non-related table, like our all-dates-containing dates table :)
Both of these solutions are ugly, but they usually work.
Another approach is to use some stored procedure to return these sequential numbers as records and link your report to such procedure; Crystal Reports and stored procedures do not behave always well however.

Related

Do not print a particular field on first page of the report

I am working on crystal reports. I want to avoid printing a field on the first page of the report, but print it on rest of the pages. I am also resetting the page number at group level. So if I suppress the field on page 1 it also suppresses on the page where the new group starts and the page number is reset to 1, which I don’t want.
If the field is suppressed on this condition:
RecordNumber = 1
it should behave like you want, i.e. it's not shown on the very first page, regardless of the CR page numbering.
Note: this one will only work if the second record started on page 1, too.
If I'm understanding your question correctly, it sounds like you are using a formula to suppress the field when PageNumber = 1, and it is suppressing the field on the first page of the report, but when you get to the next record in the group the page number resets to 1 and the field is suppressed again, when you want it to be shown.
I would try updating the suppression formula to the following.
PageNumber = 1 AND GroupNumber = 1
If you have multiple levels of grouping in your data, things can get a little interesting though. The GroupNumber function does not allow you to specify which group it is enumerating and instead returns record number for the inner most group that the function is contained within.

Crystal Reports: 4 pages, 1 report, 4 different headers

I am having troubles creating CR report with multiple pages.
What I am trying to achieve is:
Page 1: report
Page 2: same report with different header
Page 3: still same report as page 1 with different header
Page 4: same analogy
Now my reports is designed for 1 page.
Any tips? I'm little frustrated ATM...
You're going to need 4 Page Header sections. Each section will use a formula to be suppressed based upon the page number of the report. Each Page Header will be configured in the unique design needed for each of your 4 pages.
If you only have 1 row of data in your database that needs to generate all 4 reports, then you will also need 4 Details sections that use the same formula to be suppressed by page numbers. The design of the details sections will all be identical.
At some point you will also want to set the "New Page After" check box on a section. This can be done on each of the 4 details sections, or in the Page Footer sections if you use them. If you use Page Footer sections, they will likely need to use the suppression formula by page number as well.
This setup will yield 4 pages of the same data on each page, with unique page headers.
The complexity of your suppression formula will vary depending upon how much data you plan to print with each run of the report. If it will only be 1 report with a total of 4 pages then the formula will be rather simple since you only need to check for 4 possible values of PageNumber. If you plan to print multiple reports in this manner per run, then you need to check for PageNumber values that are multiples of 4 + n, where n is either 1, 2, 3, or 4. This still isn't an incredibly complex formula, providing you are 100% certain that none of the 4 pages needed for each row of data will ever exceed a single page. If that happens, the complexity of the report becomes much greater.

Increment, display, and print a number of pages up to a Parameter maximum

I am trying to set up a Crystal Report to generate pallet labels which include a "Pallet N of M" line on each page.
The order in the database only has one entry, which contains all of the other information for the label(s). My issue is that the number of pallets isn't known until print time, and each label needs the same order information as well as a pallet ID. What I am looking for is for the user to enter a parameter for the total number of pallets, then have Crystal generate the correct number of unique labels.
For example, if the order has 4 pallets then Crystal should generate 4 copies of the label, the only difference on each copy being the last line which should read 'Pallet 1 of 4', 'Pallet 2 of 4', 'Pallet 3 of 4', and 'Pallet 4 of 4' respectively.
The only solution I can think of would be to create a number of sections equal to the maximum number of pallets, all containing my real data as a sub-report, then suppress any which are greater than the entered parameter. I am trying to avoid this because we may have greater than 50 pallets on a given order, so that would be tedious to create and is just not a very clean solution.
-= EDIT =-
Big thanks to Aliqux for the solution. In the end I needed to change the syntax to be Oracle compatible and also include the LINKVALUE field in the report, but the answer was 99% there especially considering I had not mentioned that my datasource was Oracle. The Command syntax I ended up using (with my parameter called TotalPallets) was:
SELECT
-1 AS "LINKVALUE"
FROM table
WHERE rownum <= {?TotalPallets}
You will need to Add a command to your tables.
1) Under database Expert in the Database you used select Add Command.
2) Click create to Create a Parameter.
3) Create the requested values, you can leave the Default Value blank if you want, and change the Value Type to Number. (I will be calling my parameter Counter)
4) Put the following in the SQL query where table is the main table you are using
SELECT TOP {?Counter}
-1 AS LINKVALUE
FROM table
5) Click okay and enter a value if prompted
6) In links link a number field, that will never go into negative numbers as we are using -1 for a base, to the LINKVALUE in the Command Table.
7)Link Options are as followed
Join Type: Inner Join, Enforce Join: Not Enforced, Link Type: !=
8) In your report create a formula with a shared numbervalue the starts from one.
shared numbervar counters;
if counters = {?Counter} then counters := 0;
counters := counters + 1
9) You can use that formula and the Counter Parameter for your labels
totext({#Counts},0,"")+" of "+totext({?Counter},0,"")
Credit reference: https://blogs.sap.com/2014/01/24/duplicating-data-details-records-n-times-eg-repeating-labels-n-times/

Set the height of Details section Crystal Reports

The no of items in my invoice never gets more than 10. When its only one item in invoice(one row in details section) the report footer shows very up.
I want that I should fix 10 rows for the details section, when there are less rows, the remaining rows to make it 10 should be showed as blank lines.
I need the footer to appear at the same place all the time, irrespective of how many items are there in the invoice(never gets more than 10).
Please suggest solution.
Just use Sub Report and Fix the height of the sub report
then you will be able to display fix page.
I am not exactly sure what you are asking, but I will make some guesses with possible solutions.
If you print multiple invoices per report, you can group on the invoice designator, and set the report to start every invoice on a new page. In addition, you can force a new page when the record count goes over 10 rows. There are various ways to do this, but the simplest would be to add a counter that is set/reset at the start of an invoice, and then conditionally force a "new page before" if that counter reaches 11. You can also set this to force a new page for every n + 1 records (the 11th record, the 21st record, the 31st record, etc.)
If you just don't want the report footer to show up, you can either suppress it or issue a "new page before" on report footer. This is handy if you keep a summary page for reference (# of invoices in run, total balances, etc.).
If you just don't want a floating footer, you can select "print at bottom of page" for any section. This is handy for group totals. That, with "Repeat Group Header on Each Page", you can get some very nice looking invoices.
to fix height of detail section ..suppose i want size of 8 rows/records then
right click on detail section ->section expert ->on paging tab-> check on New page before beside button (x+2) write formula below given..
IF Remainder (RecordNumber, 8) = 0 THEN
TRUE
ELSE
FALSE
I know this question is really stale, but here's how to do what the OP asked.
You need to do 2 things. Find out the amount of real estate you need on the page for the 10 rows, and create a group footer that is that size directly beneath the detail line (e.g 2" or 5 cm).
Then, go into the section expert for the detail line and check the Underlay Following Sections box.
If you are ever going to have more than 10 detail lines, you also need to go to New Page after on the Paging tab and put in 10.
Put all fields Top = 0
Decrease section height.
Now, you have to set fields top dynamically.
Like this:
cr.Section1.ReportObjects.Item("Line1").Top = 0
cr.Section1.ReportObjects.Item("Line2").Top = cr.Section1.ReportObjects.Item("Line1").Top + cr.Section1.ReportObjects.Item("Line1").Height

Addid Static Report Titile on Crystal Report

i have faced some problem , when i want to display some static Title after i have displayed a few number of Rows . for Example , the first 4 rouws on crystal Report has header"Training " the next 4 rows mmust have "Education " Report Header.
i am trying to display the report using by calling one Stored Procedures any one who can help me please??
You could insert a new detail section above your current detail section and have the new section only be visible based on record count or some value in the data. Add a new section in the details, Format Section->Suppress and enter a formula controlling when the new section is visible. For example, a running total field named InspIDCount and this formula in the suppress section ({#InspIDCount} mod 5 <> 0) will cause a blank row every 5 records. The new section could contain a formula to display the correct "title".
I think I misunderstood your question. The number of rows for each type is probably not constant. A better way to handle this would the to insert a group into your report if the data is not already grouped. Group by the record type (Education, Training Etc). You probably want to suppress the group header but show group by footer. The footer could display a field from the database showing the type or it could display a formula (string) based on the record type. It would only take a few minutes to give this a try.