Friday, June 17, 2005

Limiting Records per Page in Crystal Reports.net

Limiting Records per Page


Applies to
All versions
Conditional formulas
Formula evaluation

Synopsis
Having difficulty formatting information within your crystal reports? Maybe you need to limit your records being display per page.

Solution
Create a manual running total to count the records in the Details section. The running total consists of two formulas: @Reset and @Details.

Example
An order must be printed with only 6 records per page.

1. Create the @Reset and @Details formulas:

@Reset - this formula goes into the Page Header. It resets the counter to 0 when SCR moves to a new page.

WhilePrintingRecords;
NumberVar counter := 0

// declare a number variable and assigns
// it a value of zero

@Details - this formula goes in the Details section. It counts each record.

WhilePrintingRecords;
NumberVar counter;
counter := counter + 1

//increments the variable by 1 for each record on the page

2. Use the @Details formula to conditionally force a "New Page After". Every time the counter reaches the sixth record, it moves to a new page and prints the next set of six records.
  • Go to Format | Section, and select the Details section.
  • Click the "X+2" button beside the "New Page After" option (do NOT check the New Page After box). This opens the Condtional Formatting Formula Editor.
  • Enter the following condition:
    {@Details} = 6
This formula forces a new page every time CR reaches the sixth record displayed on every page. The count resets to zero on every page because of the {@reset} formula in the Page Header.


Have a Nice Day
 
Ritesh Kumar Kesharwani
Software Professional (MCAD)
Cell  :  011-91-9845657636


Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football

6 comments:

Brijesh said...

I was trying to limit number of record per page and i found this solution every where but somehow this solution is not working for more than 14 record means just try to limit record printing to 14 record.
it will fail
?????

Rem said...

Your blog is very nice...
visit my blog asp.net example

amol said...

Hey i read ur solution carefully
when i use running total Formula n can't get way to make @Details or @Reset Formula
i tried to make it from Formula Fields and use ur solution there but when i used that @Details Variable to Detail's Section new page after to print only 6 records it shows me message that it requires boolean and when i checked it that @Details Datatype is boolean please give me solution on dis
m waiting for ur reply
thnx

Anonymous said...

how viagra works how does viagra work get viagra homemade viagra buy viagra in london england viagra equivalent how to buy viagra viagra strips suppliers of viagra effects of viagra viagra rrp australia viagra blood pressure cheapest viagra in uk viagra professional

Anonymous said...

[url=http://www.blingforfun.com]hip hop jewelry[/url],[url=http://www.blingforfun.com/pendants/cat_9.html]hip hop pendants[/url],hip hop watches,[url=http://blingforfun.com/belts/cat_18.html]bling bling[/url] ,hip hop,[url=http://blingforfun.com/chains/cat_7.html]hip hop chains[/url],hip hop bling,[url=http://blingforfun.com/chains/cat_7.html]iced out chains[/url],[url=http://www.blingforfun.com/chains/cat_7.html]wholesale chains[/url]
hip hop jewelry
wholesale hip hop watches
hip hop rings

Anonymous said...

Order [url=http://buy-cialis.icr38.net/Voltaren]voltaren online[/url] easy - Patent Offer tegretol online easy - Advantageous Price