Print Page | Close Window

Help Creating a Dynamic Table

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=9155
Printed Date: 29 Apr 2024 at 4:09am


Topic: Help Creating a Dynamic Table
Posted By: tmbranch
Subject: Help Creating a Dynamic Table
Date Posted: 18 Feb 2010 at 9:59am
First let me say that I am a novice programmer and this is the first time I have tried to use Crystal Reports.
 
My problem.  I have a datatable with up to 20 columns of data and several hundred rows.  What I need to do is create a report that will allow the user to select which columns of data they want to report, ranging from 1 to 20 and anywhere inbetween.
 
I can create the report with all the columns but can not figure out how to hide the columns that are not wanted.  These columns could be created to have null values if that is helpful...
 
Any suggestions would be greatly helpful.



Replies:
Posted By: lockwelle
Date Posted: 24 Feb 2010 at 7:11am
This is tricky, as there a several ways to accomplish this.  I would pass a delimited string into the report, from the application and then have the report suppress the columns that don't match (or suppress all columns and only display the ones that match)...but this will leave gaps in the report. 
 
Rather, what I would do is get the data from a stored proc.  Name all the columns something generic, like col1...col20.  Then in the stored proc, fill the data for these columns correctly based on the delimited string (allowing not only user selected fields, but user selected order) and then display only the fields desired, giving a clean look to the report.  The sp will be a monster do accommodate the variable columns, but the end result should look nice.  The only hitch is if the aggregate functions used are specific to the column...like you are suppressing some rows, or some fields are always COUNT and others are SUM, this will require more coding.
 
My hope is to plant a seed of what are some of the options, not give a solution as there isn't a easy one.
 
HTH


Posted By: tmbranch
Date Posted: 24 Feb 2010 at 10:40am
HTH
 
thanks
 
I was on to that track myself, I was hoping for somethng a little easier..  Such is life..
 
Thanks for the response..
 
t



Print Page | Close Window