Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Subreport filtering Post Reply Post New Topic
Author Message
akirax
Newbie
Newbie
Avatar

Joined: 08 Jun 2009
Location: Malaysia
Online Status: Offline
Posts: 4
Quote akirax Replybullet Topic: Subreport filtering
    Posted: 17 Jun 2009 at 11:00pm
Hi everyone,
 
I have a main report link with a subreport, the relationship between the two report is reference_id. Subreport will return 100 rows data with reference_id 1 for example, or return 500 row data with reference_id 2 for example, depending on the reference id passed from main report, everything work fine.
 
But currently the customer need to see top 5 and worst 5 data only from subreport instead of all, what can i do now, i don't have any idea in passing more than one parameters from main report to subreport.
 
Any helps or comments are appreciated, thank you.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 18 Jun 2009 at 6:54am
you don't need a parameter in this case, if you did you would just create it in the subreport and link to in the main (like you did with the id, right click on the subreport inthe main report and select change links).
 
Here all you need it the top and bottom 5, a couple of formulas should be all you need.
 
a formula that counts row, simply
shared numbervar linecount := linecount +1
 
a formula that can count the number of records in the set:
shared numbervar numRec := count({table.field})
 
and a formula in the suppression of the detail line:
linecount > 5 and linecount < numRec - 5
 
that should do, the line count formula goes on the detail line, the record count goes in a group header in the subreport and the suppression on the detail section.
 
Should be a good start.
 
HTH
IP IP Logged
akirax
Newbie
Newbie
Avatar

Joined: 08 Jun 2009
Location: Malaysia
Online Status: Offline
Posts: 4
Quote akirax Replybullet Posted: 19 Jun 2009 at 12:12am
Hi lockwelle,
 
Thank you very much for the wonderful solution and details explanation, it works great now.Smile
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.047 seconds.