Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ordering a 'Linked List'

Status
Not open for further replies.

ghamblin

Programmer
Dec 15, 2004
2
US
Let me start with I have only been working with Crystal Reports for about 2 days so I'm a Newbie. The problem I'm having seems like it should have an easy fix but I can't find anything in the manual or online help that is useful. Here is the issue: We have a report that extracts comment lines out of a MAS200 db and adds them as special instructions to a work order. It adds the lines of text fine but they are not in the correct order. The line-index field appears to be random numbers and as such doesn't work for sorting. After looking deeper each record also has a link-to-previous field and a link-to-next field and the first lines link-to-previous is 0 and the last lines link-to-next is 0 and if you follow the numbers using the link-to-next field from each record to the matching line-index field everything would come out in the correct order. So I know the method that would order everything correctly But, I have absolutely no idea how to implement it. Any help or advice would be greatly appreciated.
Thanks
 
Can you not get to this field when you click on report, sort records?

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
askdon@srhconsulting.com
 
I can get to all three fields (line-index,link-to-next,and link-to-previous). The problem is that by themselves they cannot be sorted into the correct order. They are "Pointers" in a doubly linked list. And as such need to be followed from one to the next. e.g. the current records link-to-next field holds the line-index of the record that should follow it. And these numbers by them selves are in no particular order. It's something like this:

prev next index detail
0 5 37 "This is the First Line"
5 12 23 "This is the Third Line"
12 0 42 "This is the Fifth Line"
37 23 5 "This is the Second Line"
23 42 12 "This is the fourth line"

Obviously sorting any one of the fields ascending or descending will not result in ordering the lines correctly.

Thanks


 
Wow!
Forward traverse a doubly linked list. Not a phrase likely to heard often in reference to Crystal <G>. Not a clue what the underlieing Db for MAS200 is.... However, I suspect the only way to do this may be to create a Stored Procedure in the Db. Have it do a standard traversal through the pointers and create a work table. Select the recordset into Crystal, truncate the table, repeat.

Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top