Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Print records on next page based on condition Post Reply Post New Topic
Author Message
forum_usr
Newbie
Newbie


Joined: 05 Mar 2012
Online Status: Offline
Posts: 6
Quote forum_usr Replybullet Topic: Print records on next page based on condition
    Posted: 17 May 2012 at 4:39am
Hi All,

I have a requirement where I need to print all records in Detail Section on a new page if field values meet condition and if such records are more than 3.

The condition is that the values in the table field should not be equal to 'Y' and such records need to be more than 3.

This condition needs to be calculated for the records in the Detail Section so I need formula to count number of records based on condition and dynamically enable the 'New Page After' option so that it pushes the section on a new page.

I have a grouping on the report so i m assuming i would need to use the "New Page After" option on the Group Header immediately above the Detail section since I m planning on displaying the records mentioned above in the Detail section.

It would be great if this can be done using a formula because I have some more requirements that are based on the condition mentioned above i.e. if there are more than 3 records that are matching a criteria then I need to display a message etc.

Please help me with your suggestions.

Thank you.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 17 May 2012 at 5:10am
I sure you would have to create a formula.  And I am pretty sure you would need a shared variable that would 'count' the records that match the criteria.  You would then use that shared variable in the "New Page After" option.  Of course you would have to reset the shared variable after doing the "New Page After".  Without knowing a lot more details, it would be difficult to come up with an exact solution.

I hope this helps. 
IP IP Logged
forum_usr
Newbie
Newbie


Joined: 05 Mar 2012
Online Status: Offline
Posts: 6
Quote forum_usr Replybullet Posted: 17 May 2012 at 6:26am
Hi Kevlray,
Thanks for your prompt reply. I have tried using the shared variable option in a formula & placed it in the DETAIL SECTION to count records based on condition like this:

shared numbervar x;
if ({table.fieldname}) <> 'Y' then
x:=x+1;

but when i place the below formula in GROUP HEADER "New Page After", it doesnt work (i think it is because Group Header is ABOVE the Detail Section and the shared variable has not calculated records in the Detail section, but then how do i count Detail Section records dynamically i.e. before they print):

shared numbervar x;
if x > 3 then
true

Please help...


Edited by forum_usr - 17 May 2012 at 6:32am
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 17 May 2012 at 12:25pm
I believe you would have to put the formula in the details, then in the Group Footer, in the "New Page After" do the check for the shared variable. 

I have not experimented with this yet, so I am guessing a bit.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 17 May 2012 at 12:26pm
Then again maybe you need to put the check in the details section.
IP IP Logged
fjgjh687uo8
Newbie
Newbie


Joined: 12 Mar 2012
Online Status: Offline
Posts: 1
Quote fjgjh687uo8 Replybullet Posted: 17 May 2012 at 9:06pm
bumb ubm!
IP IP Logged
forum_usr
Newbie
Newbie


Joined: 05 Mar 2012
Online Status: Offline
Posts: 6
Quote forum_usr Replybullet Posted: 18 May 2012 at 3:20am
Thanks for your suggestions Kevlray. I'll try these options and hopefully get it to work.
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.016 seconds.