Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to display fix number of detail lines in a page 2

Status
Not open for further replies.

nikhil27

IS-IT--Management
Apr 30, 2004
19
US
Hi,

I have to design a report in some format. And for that I am using some formulas with the assumption that each time I will recieve fix number of detail lines in the report page. I want to keep 18 detail lines on the page. So if my database table returns 12 records, even then I want to have 18 records in the page.

I am using a stored procedure in my report which returns a cursor to the report. I can not make changes in that stored procedure so that it always returns the records in the multiples of 18.

Can I do something in the report itself so that on each page I receive 18 records ( Basically I have to draw 18 details lines in a page irrespective of number of records)

Thanks,
Nikhil
 
Bizarre.

If you only have 12 rows, how can you display 18 rows?

You can certainly repeat the last row easily, or have x number of lines with a message instead of data, but you need to define what you want as what you request is impossible...

Also posting technical information is important when requesting technical assistance:

Crystal version
Database/connectivity used
Example data
Expected output

-k
 
You could increase the size of the page header and footer sections, resulting in a smaller detail section

-LW
 
Thanks for the reply!!

Crystal version - 8.5
Database - Sybase,ODBC connectivity

Let's say I have two records in my table
Column
record1
record2

Now in the report I want to display the data like this:

1. record1
2. record2
3.
4.

Though I have only 2 records in the table, I want this count should go to 4.

If I have 6 records in the table, I want to display 4 records on the first page and on the next page I want to display 2 remaining records and 2 dummy records ( so that count on every page is 4)

Is this possoble in Crystal Report?

Thanks,
Nikhil





 
You mention in your first post that you need to "draw" 18 detail lines. If you are creating a grid, you can do this in a page header section which you then set to "Underlay following sections".

To get a maximum of 18 details per page, use a formula like the following in the section expert->details->New page after:

remainder(recordnumber,18)= 0

If you are creating the grid in the page header, it doesn't matter if you have the full complement of 18 on the last page. Otherwise, if you really need this handled in the detail section, then create a formula:

if onlastrecord then
{table.string} +
replicatestring(chr(13),18-(count({table.string})-((pagenumber-1)*18))+1)

If you have groups, the formula would have to be adapted.

-LB
 
Thanks Lbass!!

But If I use this formula, It will kind of 'grow' the last detail line. But my 'record count' formula will treat it as a single record. And, the record count will go till 16 ( let's say I have 16 records in the last page) not 18. I want that record count should also go till 18.

Thanks for all your help.

Nikhil
 
I forgot to mention that you need to format the formula with "Can Grow", but you realize that...

If you want to show numbering on each page from 1 to 18 then use two formulas instead of the earlier one:

//{@reset} to be placed in the page header:
whileprintingrecords;
numbervar pagereccnt := 0;

//{@itemno} to be placed in the detail section:
numbervar pagereccnt := pagereccnt + 1;
numbervar i := 18-(count({table.string})-((pagenumber-1)*18));
numbervar counter;
stringvar x;

if onlastrecord then
(for counter := 1 to i do(
x := x + chr(13)+
(if len(totext(pagereccnt + counter,0,"")) = 1 then
space(1)+totext(pagereccnt + counter,0,"")+"." else
totext(pagereccnt + counter,0,"")+".")));
x

I added an if/then so that the periods after the item numbers would be aligned, although this will only work if you use a nonproportional font like Courier. If you don't care about that alignment, then you can remove the if then and change the formula to:

if onlastrecord then
(for counter := 1 to i do(
x := x + chr(13)+
(totext(pagereccnt + counter,0,"")+".")));
x

Then format {@itemno} to "can grow".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top