Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...This forum is the most helpful site I've ever used. I used to use Deja.com; but, this site is better - hands down!..."

Geography

Where in the world do Tek-Tips members come from?

Print all records on next page if field values meet condition & records more than 3

bodev (TechnicalUser)
16 May 12 18:05
Hi Gurus,

Scenario:
I have a requirement where I need to print all records on a new page if field values meet condition and if such records are more than 4.

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 4 records that are matching a criteria then I need to display a message etc.

I m using crystal reports 2008. Please help me with your suggestions.

Thank you.
Madawc (Programmer)
17 May 12 5:47
Do a summary count on the group. This could be tested for in the group header, so you could use a formual to start a new page.

Also take a look at the 'Keep Group Together' option, you might find it better.

yinyang Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP yinyang

bodev (TechnicalUser)
17 May 12 9:33
Hi Madawc,

Thanks for your reply.

I m afraid the summary count on the group wont work because the condition (based on which the records in the Detail section need to be printed on the new page) needs to be calculated on the records in the Detail Section Level.

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.

I m using:

if {table.fieldname} <> 'Y' then
(numbervar counter:=counter;

if counter > 4 then
true
else
false)

In Group Header Section Expert, I inserted the above formula in "New Page After", but it does not work. I used the first 2 lines of the above in a formula (if {table.fieldname} <> 'Y' then (numbervar counter:=counter; ) and placed it in the Page header, but counter remains at zero. The same thing happens when i try to put this formula in Group Header i.e. it does not seem to increment the counter.

Please help.

Thanks.




bodev (TechnicalUser)
17 May 12 14:43
someone please suggest something. I m out of ideas at the moment...[sad]
CoSpringsGuy (IS/IT--Management)
17 May 12 15:23
i haven't wrapped my brain around what you are trying to do but a quick look at your formula tells me you arent incrementing counter so, as your code stands, it will always be 0.

try
if {table.fieldname} <> 'Y' then
(numbervar counter:=counter + 1;

if counter > 4 then
true
else
false)

don't think that's gonna help you overall though

_____________________________________
Crystal Reports 2008 and XI
Intersystems Cache 2012 ODBC connection

bodev (TechnicalUser)
17 May 12 16:32
i m sorry that was a typo. I m actually adding the 1 to the counter so that it increments. Let's suppose i have the following data:

column A Column B
A NY
B London
C Paris
D London
E London
F Berlin
G London

also, suppose that I have a group on some other field in the report besides the fields that i m mentioning above.

In this scenario, how will i make a formula that counts the number of times 'London' appears and if it appears more than 3 times, it moves the records to the next page.
Madawc (Programmer)
18 May 12 5:16
There's a trick that allows summary totals that only count some of the data. Do

CODE --> @CheckValue

if {table.fieldname} <> 'Y' then 1 else 0
You can now do a summary count of @CheckValue.

yinyang Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP yinyang

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close