Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Dynamic Columns and Group Post Reply Post New Topic
Author Message
JediKnight
Newbie
Newbie
Avatar

Joined: 01 Apr 2010
Online Status: Offline
Posts: 4
Quote JediKnight Replybullet Topic: Dynamic Columns and Group
     Posted: 01 Apr 2010 at 2:29am

Hello there!

I am developing report using .Net and Crystal X and I have a big challenge. Unfortunately, I am new using Crystal and need your help.
 
I need to create a report where the user whill select the columns that will appears in report and the columns to Group By.
 
I saw a tutorial to how implement the dynamic columns and it is working fine, but I have some questions:
 
1 - To show the dynamic columns, I had to create a report with the possible columns to show and I created a formula to supress then, when don´t have to show. The question is: How and where change the width of the field dynamicly? In Crystal or .Net, before open the report? Because the width of a date character is not the same as an address and I am having problems with the layout alignment.
 
2 - As I said, the user can choose 1 or more columns for group and order by. How can I implement this dynamic group/order for these dynamic columns? It is better processing the query in a DataSet or DataTable and then pass this object as parameter?
 
I think these are the biggest problems.
 
Any help is welcome!
 
Thank you,
 
Regards
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 01 Apr 2010 at 3:23am
While I haven't seen the tutorial, I have created 1 report with dynamic columns, what I did, was create each column and size it as desired. Then each column was told how to find it's location (based on a formula) or to suppress itself. The location / order of the colums was governed by a delimited string. Then all of the columns were set to the same location...far left of the report.  In CR XI, you can use the size and position option to dynamically move an object, the only caveat is the movements are in 1440th of an inch. That's how I got the columns to move.
 
For grouping, the simplest is to have a field in your dataset that the result of grouping.  Say you want to group by company and division, just concatenate the fields together. This is easy to in a stored proc.  Just using a formula would be a pain, as you would need to cover ever combination of fields which quickly grows unmanagable as the combinations would by the factorial of the number of fields in the report / 2 or n!/2.
 
My generic answer is to always get the data from a stored proc.  If necessary, you can have the .Net do some data manipulation, and then pass the completed dataset to the report.  Barring that, get the data from a stored proc straight into the report is much more flexible that just joining to the tables directly from CR
 
HTH
IP IP Logged
JediKnight
Newbie
Newbie
Avatar

Joined: 01 Apr 2010
Online Status: Offline
Posts: 4
Quote JediKnight Replybullet Posted: 01 Apr 2010 at 3:57am
Hello lockwelle, thank you for your reply!
 
I made some tests and I got the object move. I think to solve this problem, I will have to create an enumerator with the width value of each column and use this values to increase/decrease the width and left position.
 
For the grouping, I will use the stored procedure :)
I will return the result direct and report will only show this results, without to many formulas (I hope).
 
Thank you again,
 
May the force be with you.
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