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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting problem

Status
Not open for further replies.

hp22015

Programmer
May 19, 2003
19
0
0
US
Hello all,

Please help!

I have a report that will display the following data:

ID TaskName FatherID
1 a1 f1
1a s1a 1
2a s2a 1
2 a2 f1
2c c2 2
2d d2 2
11 a11 f11
22 a22 f11
33 a3 f1

I would like to have the data sorted or grouped by FatherID. As you can see the data seems sort in the way I wish but it is not since by the end of the report, one FatherID is not in the gruop. Here is the way that I would like to display the data:

ID TaskName FatherID
1 a1 f1
1a s1a 1
2a s2a 1
2 a2 f1
2c c2 2
2d d2 2
33 a3 f1
11 a11 f11
22 a22 f11

Can you help me out? Thanks.

HP


 
hi
change your link to left other join

hope this helps

pg
 
hp,

It's like this, if you are grouping on FatherID, the problem is that 1 comes before F1, etc.

You could group by FatherID in specified order, but if you group, the output won't look like your example.

This is what you get if you group on FatherID:

ID     TaskName    FatherID
Group    1
1a   s1a     1
2a   s2a     1
Group    2
2c   c2     2
2d   d2     2
Group    f1
1   a1     f1
2   a2     f1
33   a3     f1
Group    f11
11   a11     f11
22   a22     f11


What you need is a SortID field in your database:

ID     TaskName      FatherID SortID
1      a1            f1 1
1a     s1a           1 2
2a     s2a           1 3
2      a2            f1 4
2c     c2            2 5
2d     d2            2 6
33     a3            f1 7
11     a11           f11 8
22     a22           f11 9

Add a SortID field in your database, put ID, TaskName, and FatherID in the details section of your report. Choose the 'A-Z' sort expert and sort on SortID field.

Hope that helps.

Tom


 
Many thanks to Pg and Tom. You are really champions for helping me out. The problem is resolved. Thank you very very much. Take care.

HP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top