Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Can this be done with a CrossTab Post Reply Post New Topic
Author Message
dinosuar
Newbie
Newbie


Joined: 10 Apr 2008
Online Status: Offline
Posts: 1
Quote dinosuar Replybullet Topic: Can this be done with a CrossTab
     Posted: 10 Apr 2008 at 10:00am
First of all I have no control of the database I am reading from so I cannot create temp tables or records in the database.  I cannot ever read the tables directly I am passed a results set to work with.

I need to display info in a Cross Tab report layout.  There are three columns and multiple rows. The columns headers are High, Medium, Low.  The rows are problem report areas.  I would like a cross tab that displays how many high, medium, and low problem reports are submitted for each report area.  The header info is stored in a column called priority and the problem report areas are stored in a column called report_area.

So it would look like the below report.

                            High     Medium     Low      Total
Hardware              1            2              0            3
Software                3            0              5            8
User                       0            0             10           10
ROW#N                 value n   value n

You get the idea. 

The problem is that for each row of the result set, there is only one value for priority (high ,medium, or low) but for the report_area values, they are stored as a space delimited value.  Meaning each record can be associated with one or more report_areas. 

Is it possible with the features provided by Crystal Reports to put this info into a cross tab report.  Right now I have a cross tab report for each report_area.  I would like to put it into one report.
   
IP IP Logged
themessenger
Groupie
Groupie
Avatar

Joined: 15 Aug 2008
Location: United Kingdom
Online Status: Offline
Posts: 48
Quote themessenger Replybullet Posted: 15 Aug 2008 at 4:39am
Get a list of all report_areas - either from database of from a list in an excel file.  Don't join the above list and your data tables so you get the cartesian product from both tables

Create the three following formulae

myHighCnt:
if {Priority} = 'High' and {Field1} in {Field2} Then 1 else 0

myMedCnt:
if {Priority} = 'Medium' and {Field1} in {Field2} Then 1 else 0

myLowCnt:
if {Priority} = 'Low' and {Field1} in {Field2} Then 1 else 0

place all three of these on the detail line.

Now you should be able to build your cross-tab:

                     !myHighCnt           !myMedCnt
=======================================
report_area  !  SUM(myHighCnt) ! SUM(myMedCnt) ! etc

Managing Director
www.allmymenus.com
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