Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Group by one field, sort by another Post Reply Post New Topic
Author Message
huddy33
Groupie
Groupie


Joined: 23 Apr 2009
Location: United States
Online Status: Offline
Posts: 54
Quote huddy33 Replybullet Topic: Group by one field, sort by another
     Posted: 28 Mar 2014 at 9:34am
I have a report that is first grouped by type (i.e. speaker, client, etc). Once that grouping is performed, the end user wants the report to sort by email if the type is a client or to sort by affiliation if the person is a speaker.

I cannot figure out a way to force the sort by a non-grouped field and grouping by that field doesn't seem to work either.

Ideas?

it needs to look like this:

Speaker (group header - ordered by Last Name)

Bob Jones Private Practice
Sarah Thomas Zane Dental


Client (group header - ordered by email)
Hannah Boden hboden@email.com
Amy Parker    parkeramy@email.com]

Edited by huddy33 - 28 Mar 2014 at 9:39am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Mar 2014 at 9:57am

logically what you want to do is not possible unless records inside the group use the same email, otherwise when you sort by email it splits up the group.

if that is the case make a formula field to concatenate the email and other field together and gropup on that.
 
Otherwise you have to make a determination of which email in the group becomes the only email for the group that is relevant and then you can likely sort the groups using a group sort, not a field sort.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Mar 2014 at 10:04am
I did not see your edit before I started my last post so it may not be entirely relevant...
Do you mean you want all records mixed together but using a different field to sort? So your sample data ends up like the below using the red as the sorting criteria?
 
 
Hannah Boden hboden@email.com
Amy Parker    parkeramy@email.com]
Bob Jones Private Practice
Sarah Thomas Zane Dental

 


Edited by DBlank - 28 Mar 2014 at 12:07pm
IP IP Logged
huddy33
Groupie
Groupie


Joined: 23 Apr 2009
Location: United States
Online Status: Offline
Posts: 54
Quote huddy33 Replybullet Posted: 31 Mar 2014 at 2:13am
Originally posted by DBlank

I did not see your edit before I started my last post so it may not be entirely relevant...
Do you mean you want all records mixed together but using a different field to sort? So your sample data ends up like the below using the red as the sorting criteria?
 

 

Hannah Boden hboden@email.com Amy Parker    parkeramy@email.com[/COLOR">>

Bob Jones Private Practice Sarah Thomas Zane Dental <SPAN style="FONT-SIZE: 10px"></SPAN>

<SPAN style="FONT-SIZE: 10px"> 
</SPAN>


No, I need everything to group by the type but sort by last name for group and then sort by email for group 2. What ended up working, despite thinking I'd already tried it was creating this field:

[COLOR=black]Sort2: if {table_AttendeeTypes.AttendeeType2} = "Speakers"
then {Attendee.LastName}
else
if {table.AttendeeType2} = "Client"
then {Attendee.Email}

and then sorting by AT2, then Sort2. I know this is what I tried initially, as it makes sense to me, but I must not have done it correctly.

Thanks for your help![/black]

Edited by huddy33 - 31 Mar 2014 at 2:16am
IP IP Logged
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