Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Dynamic Columns Post Reply Post New Topic
Author Message
ekendricks
Newbie
Newbie


Joined: 03 Jan 2010
Location: United States
Online Status: Offline
Posts: 5
Quote ekendricks Replybullet Topic: Dynamic Columns
     Posted: 03 Apr 2010 at 5:45am

I'm using CR 2008 and SQL 2005.  I have a SP that returns column names based on the Day, for a particular date range.  ie:  3-15-10 thru 4-1-10 returns columns of  15-16-17-18-19-20-ETC.  The number of columns can be 1 to 30, and changes depending on the input parameters.  The SP works and when run in MMC, it returns what I want.

The challenge is, getting this to show in a Crystal Report, drawing the columns based on what is returned from the SP.  The report dynamic columns should minic the same as returned by the SP:

EmpID       EmpName          15     16   17  18   19   20  ETC
OR
EMPID       EmpName            1       2     3     4     5    6   ETC
OR
EMPID       EMPName            29     30   31     1    2    3  ETC
 
Thanks for any and all help....
 
 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 05 Apr 2010 at 9:51am
The challenge here is that Crystal stores the field names at design time.  So, if the field names change, Crystal doesn't know how to map them to data.
 
I suggest  doing a search on the forums here for the word Dynamic to see what other folks have come up with for suggestions as there has been a lot of discussion over the last couple of years on similar topics.  If you don't find anything that will work for you, then it may not be possible using your stored procedure as is and you'll have to come up with another method of getting to the data.
 
-Dell
IP IP Logged
JediKnight
Newbie
Newbie
Avatar

Joined: 01 Apr 2010
Online Status: Offline
Posts: 4
Quote JediKnight Replybullet Posted: 06 Apr 2010 at 2:11am

Hello there!

I had the same problem: Create a report with dynamic columns.
 
To show the dynamic columns, you will create a report with the possible columns to show (in your case 30) and you will have to created a formula for each column to supress then, when don´t have to show.
 
But, be carefull with your layout, because Crystal is not so smart to increase the width dynamic.
 
I hope this can help you!
 
May the force be with you.


Edited by JediKnight - 06 Apr 2010 at 2:23am
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