Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

bodev

Technical User
Mar 5, 2012
15
US
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.
 
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]
 
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.




 
someone please suggest something. I m out of ideas at the moment...[sad]
 
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

 
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.
 
There's a trick that allows summary totals that only count some of the data. Do
Code:
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]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top