Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Hierarchical groups and views or stored procedure Post Reply Post New Topic
Author Message
Inna
Newbie
Newbie
Avatar

Joined: 22 Dec 2008
Location: Ukraine
Online Status: Offline
Posts: 2
Quote Inna Replybullet Topic: Hierarchical groups and views or stored procedure
    Posted: 22 Dec 2008 at 2:58am

I'm building report in Visual Studio 2008 designer.

It’s data is taken from procedure with parameter or it would even nice if I could use views

 

Why does menu Cristal Reports -> Report -> Hierarchical Group Options is inactive? Dead

 
My task was:
Report with hierarchscal data. Table has ID and Parent_ID columns.
But I have input parameter than means head Parent_ID from wich to begin hierarchy
 
for example
 
   ID  Parent_ID  Name
   1       null          transport  
   2        1            Buss
   3        2              Buss Engine
   4        2              Buss Wheel
   5        1            Tram
   6        5               Tram Engine
   4        5               Tram Wheel
 

How can I build hierarchy only for Busses or only for Trams or for All transport accordingly to an input parameter?



Edited by Inna - 22 Dec 2008 at 2:59am
IP IP Logged
Inna
Newbie
Newbie
Avatar

Joined: 22 Dec 2008
Location: Ukraine
Online Status: Offline
Posts: 2
Quote Inna Replybullet Posted: 23 Dec 2008 at 1:15am
HELP
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 23 Dec 2008 at 2:43pm

Here's what I would do. (For simplicity, I'm going to call your table "Transport".)

1. Create a new report using the Standard Report Creation Wizard.  Add the Transport table.

2.  Add the Transport table again.  Crystal will tell you the table has already been added and ask if you want to "add another alias" to the table.  Click on Yes. 

3.  You'll see two tables in the Selected Tables section of the screen, one with the name of your table and one with the name of your table plus "_1".

4.  Click on "Next".
 
5.  If you have SmartLinking turned on, delete any links that Crystal has created between the two tables.  Then link from ID in Transport to ParentID in Transport_1.
 
6.  Finish creating the report as you normally would.  I would probably group it on {Transport.Name} and then sort on {Transport_1.Name}.
 
7.  In the Select Expert, add {Transport.Parent_ID} = 1 to get only the top-level items in your heirarchy at the top level.
 
If there are more levels in your heirarchy, you'll add more copies of the table and link from the previous one - Transport_1.ID to Transport_2.Parent_ID, etc.
 
This method works if there's a very limited number of levels - I would say 4 or 5 at the most.  If there are some items that have fewer levels and some with more, you'll need to make all of the joins left-outer joins. 
 
-Dell
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.