Reputation: 1143
I would like to group by one field and sort by another field with Crystal Report.
For example: Group A
with PO Number
(sort ASC). For each PO Number, there is one Name with it and I would like to sort by Name_x
.
I have tried to add a field with Record sort Expert
or I created a new group with Name_x
and then sort by a new one but it does not work.
PO_1 Name_4
PO_2 Name_2
PO_3 Name_3
PO_4 Name_1
PO_5 Name_7
PO_6 Name_6
The result must be:
Name_1 PO_4
Name_2 PO_1
Name_3 PO_1
Name_4 PO_1
Name_6 PO_6
Name_7 PO_5
Upvotes: 1
Views: 22147
Reputation: 5746
Use Report->[Group Sort Expert...] to define desired sorting strategy for the group
Upvotes: 0
Reputation: 212
I would like to suggest an easy solution:-
Upvotes: 6
Reputation: 4610
Your problem doesn't make any sense... If you have one PO Number who have only (unique) Name why then group by one attribute and sort by the other one? You have relation 1:1 which means if you group by PO then you get result :
PO_1 Name_4
P0_2 Name_2
If you group by Name then you get:
Name_1 PO_4
Name_2 PO_1
And that's it... You group by a attribute by which you want to sort by. If you have relation 1:N then this whole problem is solved by another way, but this is not important to this question. Your solution with "suppressing" field work also but it's slower because you first group by some attribute, then suppress details, then calculating sum of it etc... this solution is a lot simplier
Upvotes: -1
Reputation: 1143
I've found the solution as below and it works pretty well. Please let me know if you have any idea.
Solution: We will create summaries within each group which we can use for the sort function.
Upvotes: 7