Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: nuber of columns in CrossTab Reports Post Reply Post New Topic
Author Message
oksana
Newbie
Newbie


Joined: 28 Jan 2008
Location: United States
Online Status: Offline
Posts: 17
Quote oksana Replybullet Topic: nuber of columns in CrossTab Reports
     Posted: 04 Sep 2009 at 4:30pm
I'm trying to create a crosstab that always has the same set of columns.
I don't have any record for some of the columns, but want that columns to show in the crosstab with 0 values. 
Any ideas on how to achieve this?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Sep 2009 at 7:23pm
Use a source table with all values that you can left join to the "data table" and then use the source table with all values as your column field in the CT.
IP IP Logged
oksana
Newbie
Newbie


Joined: 28 Jan 2008
Location: United States
Online Status: Offline
Posts: 17
Quote oksana Replybullet Posted: 05 Sep 2009 at 7:08am
Not sure how to do it. For instance I have
T1
id   period   group      total
A     1            NN           15
B     1            NN           20
A     1            PP           30
A     2            NN           5
 
 
 
T2
period
1
2
 
 
Result
group NN
Id        period
          1    2
A        15   5
B        20   0        
 
group PP
id      period
A        1    2           I am not getting that column since I have no data for
Total  30   0          period 2
 
 
 
 
 
 
 
 
IP IP Logged
leoneking
Newbie
Newbie


Joined: 03 Sep 2009
Location: Philippines
Online Status: Offline
Posts: 4
Quote leoneking Replybullet Posted: 07 Sep 2009 at 1:34am
1. Create a dataset that filters only the "PP" groups. (let's call it Set2)
 
2. Left Join in the original dataset (let's call it Set1) [no filter]
 
3. Create a formula field:
if {Set1.group}= "NN" then
0
else
{Set1.total}
 
4. In the crosstab, choose Set1.period - column
Set2.id - row, sum of @newFormula - summarized field.
 
5. In the Customized Tab, tick "suppress empty rows".
 
Hope this helps. :)
IP IP Logged
oksana
Newbie
Newbie


Joined: 28 Jan 2008
Location: United States
Online Status: Offline
Posts: 17
Quote oksana Replybullet Posted: 08 Sep 2009 at 6:03am
Thank you but I am not sure how to join datasests. Could you please provide me an example? I work in vs.net 2008.
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