Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: formula for Group Header Post Reply Post New Topic
Author Message
Memoli28
Groupie
Groupie
Avatar

Joined: 10 Apr 2009
Online Status: Offline
Posts: 58
Quote Memoli28 Replybullet Topic: formula for Group Header
     Posted: 16 Jan 2010 at 3:44am
Hi All,
 
I have the following issue in my report:
 
Group Header:     Routecode
 
Details: Routecode               Ordernumber       OrderStatus
                   ABE                          1                           A
                   ABE                          2                           L
                   ABE                          3                           P
                   ABC                          4                           A
                   ABC                          5                           A
 
I made a grouping for routecode.
 
What i want to have is on Group Header a formule which checks for every ordernumber the orderstatus.
 
and if ,within a group all orders have status A ,then the formula must return a value 'N' else 'Y'  on Group Header.
 
So,in above example:
routecode ABE   should get 'Y' (not all orders status A)
routecode ABC  should get 'N' (all orders have A)
 
any help is appreciated.
 
Regards,
Memoli
 
 
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 16 Jan 2010 at 11:26am
can't do it in group header unless you use a subreport...the report hasn't read all the records in the group, so it doesn't know the outcome.  A subreport will stop processing the main report and process the subreport and then return, so it will have 'read' the data already, but the main report will remain oblivious to the results (unless you use a shared variable).
 
You can try the subreport, which will work, but may hurt performance (you are basically reading the data twice). If you are getting the data from stored proc or view you can determine the value before it gets to the report...just another way to approach the problem
IP IP Logged
Memoli28
Groupie
Groupie
Avatar

Joined: 10 Apr 2009
Online Status: Offline
Posts: 58
Quote Memoli28 Replybullet Posted: 17 Jan 2010 at 7:49am
Hi Lockwelle,
 
I dont know so much about shared variables and subreporting.
 
I tried many options and found below solution:
 
create a new formula which says if status=A then 1 else 0 and putted on the detail section.
 
 
i did a summary for the group header for Orders.(count orders)
also a second summary for the new created formula,which actually sums the '1'.
 
And if this 2 summaries match each other then 'N' else 'Y' on group header with a new formula.
 
it seems it is working very nicely:-)
 
regards,
Memoli
 
IP IP Logged
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