Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: issue of limiting No. records to be displayed Post Reply Post New Topic
Page  of 2 Next >>
Author Message
johnwsun
Senior Member
Senior Member


Joined: 28 May 2008
Location: Australia
Online Status: Offline
Posts: 179
Quote johnwsun Replybullet Topic: issue of limiting No. records to be displayed
     Posted: 23 Sep 2009 at 8:26pm
Hi All,
 
I have a report where it's grouped by user, the detail section shows all that user's loan items such as book title, unit cost, total cost, etc. I was attamping to limit 6 records to be displayed in the Detail section and the rest to be displayed on the next page if there are more than six records.
 
I went to the section expert, Check the New Page After, and in X-2 formula, I used the following:
 
if Remainder (RecordNumber, 6) = 0 then
   true
else
  false
 
The records looks OK for first user( who has 8 records)- 6 displayed on first page, the rest 2 in the next page.
However the second user who has 9 records - 4 displayed on the page and 5 displayed on the next page.
Could anyone advise a better appropriate approach for this? thanks in advance.
John
IP IP Logged
Jyothi Yepuri
Senior Member
Senior Member


Joined: 11 May 2009
Location: Australia
Online Status: Offline
Posts: 127
Quote Jyothi Yepuri Replybullet Posted: 23 Sep 2009 at 11:39pm
If I understood correctly, on 2nd page its displaying 2 records of 1st user and 4 records of 2nd user...thats total 6 records per page..

is it 6 records per page per user?

Jyothi
IP IP Logged
johnwsun
Senior Member
Senior Member


Joined: 28 May 2008
Location: Australia
Online Status: Offline
Posts: 179
Quote johnwsun Replybullet Posted: 23 Sep 2009 at 11:48pm
Hi Jyothi,
 
The third page is supposed to be the second user with records = 6, but instead of 4, and the next page is 5
The first page for each user is supposed to be 6, and the rest of the records will be the in next page of each user when there are more than 6.
John
IP IP Logged
Jyothi Yepuri
Senior Member
Senior Member


Joined: 11 May 2009
Location: Australia
Online Status: Offline
Posts: 127
Quote Jyothi Yepuri Replybullet Posted: 24 Sep 2009 at 12:31am
Hi John,

Try like this..
create formula to calculate record number for each group
//INIT
numbervar cnt;
IF OnFirstRecord OR GroupName ({Command.User}) <> Previous( {Command.User}) then
cnt:=1
else
cnt:=cnt+1

and in New page After ..use this condition
Remainder({@Init},6) = 0 OR Count ({Command.Loan_ID}, {Command.User}) = {@Init}

HTH,
Jyothi

IP IP Logged
johnwsun
Senior Member
Senior Member


Joined: 28 May 2008
Location: Australia
Online Status: Offline
Posts: 179
Quote johnwsun Replybullet Posted: 24 Sep 2009 at 5:08am
Hi Jyothi,
 
Your formula works!  Thanks a lot
 
John
IP IP Logged
johnwsun
Senior Member
Senior Member


Joined: 28 May 2008
Location: Australia
Online Status: Offline
Posts: 179
Quote johnwsun Replybullet Posted: 24 Sep 2009 at 6:39pm

Hi Jyothi,

I suddently found that sum of cost for the records in the Detail section was pushed the third page, e.g.

one user's first page has 6 records, second page has two records, and the third page prints out the summary of cost of 8 records. Should that sum in the second page?

John
IP IP Logged
Jyothi Yepuri
Senior Member
Senior Member


Joined: 11 May 2009
Location: Australia
Online Status: Offline
Posts: 127
Quote Jyothi Yepuri Replybullet Posted: 24 Sep 2009 at 6:49pm
Where did you place this summary field?
and where do require that in second page?

Jyothi
IP IP Logged
johnwsun
Senior Member
Senior Member


Joined: 28 May 2008
Location: Australia
Online Status: Offline
Posts: 179
Quote johnwsun Replybullet Posted: 24 Sep 2009 at 6:52pm
Hi Jyothi,
 
sum of cost is in the group footer, and it should be under the last record (under the detail section), of second page, shouldn't it?
J
IP IP Logged
johnwsun
Senior Member
Senior Member


Joined: 28 May 2008
Location: Australia
Online Status: Offline
Posts: 179
Quote johnwsun Replybullet Posted: 24 Sep 2009 at 7:30pm
Hi Jyothi,
 
I have solved the problem. I changed your formula where I put one line
whileprintingrecords;
numbervar cnt;
IF OnFirstRecord OR GroupName ({@borrower_name}) <> Previous( {@borrower_name}) then
cnt:=1
else
cnt:=cnt+1
 
and then chanded the line in New Page After (X-2) where I have used:
if Remainder ({@count_records}, 6) = 0 then
   true
else
  false
cheers,
 
John
 
IP IP Logged
Jyothi Yepuri
Senior Member
Senior Member


Joined: 11 May 2009
Location: Australia
Online Status: Offline
Posts: 127
Quote Jyothi Yepuri Replybullet Posted: 24 Sep 2009 at 7:30pm
In Details ..new page after

IF DistinctCount ({Command.LoanId}, {Command.user})>6 then
Remainder({@Init},6) = 0 and DistinctCount ({Command.LoanId}, {Command.User})<> {@Init}


In GF ..new page after
Count ({Command.LoadId}, {Command.User}) = {@Max}

in @Max formula
Shared numberVar cnt; // variable from @Init

HTH,
Jyothi
IP IP Logged
Page  of 2 Next >>
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