Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Sorting Hierarchical Data Post Reply Post New Topic
Author Message
cmross
Newbie
Newbie


Joined: 05 Nov 2014
Online Status: Offline
Posts: 10
Quote cmross Replybullet Topic: Sorting Hierarchical Data
    Posted: 23 Jan 2017 at 2:59am
Is there a way to sort hierarchical data by a different field?

Level 1 (#2)
..Level 2 (#1)
..Level 2 (#3)
..Level 2 (#2)
....Level 3
....Level 3
Level 1 (#1)
..Level 2 (#3)
..Level 2 (#1)
....Level 3
....Level 3
..Level 2 (#2)

Where The #s are a value in a different field. It is currently sorted by the information in the field that contains the levels. I'd like it to show like:

Level 1 (#1)
..Level 2 (#1)
....Level 3
....Level 3
..Level 2 (#2)
..Level 2 (#3)
Level 1 (#2)
..Level 2 (#1)
..Level 2 (#2)
....Level 3
....Level 3
..Level 2 (#3)

Is there a way to do this?

Edited by cmross - 23 Jan 2017 at 3:01am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 23 Jan 2017 at 9:59am
Is all of this in a single table? Does each record have a "parent id" of the record that's the next higher one in the hierarchy? What's the max number of levels you might have? Does the data say which level any given record is at?

-Dell

Edited by hilfy - 23 Jan 2017 at 10:00am
IP IP Logged
cmross
Newbie
Newbie


Joined: 05 Nov 2014
Online Status: Offline
Posts: 10
Quote cmross Replybullet Posted: 24 Jan 2017 at 8:06am
It is currently not in a single table, but I can make a table to make them all in one if it's necessary.

Yes, each record has a parent ID. Level 1 would be the parent of Level 2, and then Level 2 would be the parent of Level 3.

I could see instances where there are as many as 5 levels.

No, the data does not say which level any give record is at.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 24 Jan 2017 at 8:55am
There is no way to do this directly in Crystal since there is no information about which level each is at. However, I can see ways to do this using either a Stored Function or a Stored Procedure so that you get a data set that has the level information that you're looking for.

What type of database are you connecting to?

-Dell
IP IP Logged
cmross
Newbie
Newbie


Joined: 05 Nov 2014
Online Status: Offline
Posts: 10
Quote cmross Replybullet Posted: 24 Jan 2017 at 9:18am
Pervasive SQL.
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.015 seconds.