Solved

Crystal Reporting XI - how to have Sort "override" Grouping

Posted on 2009-07-01
10
375 Views
Last Modified: 2012-05-07
I have a report that is grouped by Job Number.

The report only display header type of data for each Job Number so I don't need to do any sorting of records within the group since there is only header type data.

What I need to do is have the overall report sort by a field within this header data that happens to be a Date field. This Date field is displayed in the group footer.

Is this possible?  When I go into Sort Expert, it has my Job Number grouping as the primary sort and will not let me put this Date field above it to be the primary sort??

thanks

0
Comment
Question by:JMO9966
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 5

Accepted Solution

by:
jgbreeden earned 100 total points
ID: 24756190
Why do you have it grouped on Job Number, are there child records or just multiple occurrences of each job in the main table?  If it is a child table, you could use a sub report & pass the job number to the sub, then remove the grouping in the main report.  If it is multiple records in the main table, I don't think you can override the grouping in the sort.
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 300 total points
ID: 24759487
When you group a report, Crystal automatically makes that the first sort for the report.  That is how it groups the records.

You can then add secondary sorts.

It is possible to sort the groups by another field through the GROUP SORT EXPERT>  You must have a summary function on the field you want to use.  For instance on your report if the last record in a group has the max date you could add a summary Maximum({DateField}) then use the GROUP SORT EXPERT (under the REPORT menu) to sort the groups on the max date.

mlmcc
0
 
LVL 34

Assisted Solution

by:James0628
James0628 earned 100 total points
ID: 24769197
If you simply want to sort by another field before a group, simply create a group on that field.  Suppress the new group header and footer and you've essentially sorted the original group(s) by the new field.  Note that if this is a date/datetime field, CR will default to grouping "for each week".  If you want the report grouped (sorted) by each day, you'll need to go into the group options and change that setting.

 James
0
 

Author Comment

by:JMO9966
ID: 24814569
Go thoughts guys, but let me add more details.

I have a summary in my group footer (grouping=by Job Number) that tells me the maximum value for the left join table.  The summary field tells me the max sequence (integer) in this table for that particular job number.  I then use this formula to display the date for the max sequence row.

If {Job_Op.Sequence}={@Max_sequence} Then
{Job_Op.Sched_End}

Keep in mind, the max sequence may not necessarily have the max date value, that's why I had to go this route since I really need the date for the max sequence not necessarily the max date.

I attempt to do a grouping on this formula field, but it does not appear in my list as objects I can group by, most likely because the formula is based on a summary field.

Please give me your thoughts. I'm increasing points to 500 now.
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 300 total points
ID: 24815034
I don't think you will be able to group on that formua.

What is the @Max_Sequence formula?

mlmcc
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:JMO9966
ID: 24815229
Maximum ({Job_Operation_2.Sequence}, {OP_ActiveJobs_TTX.Job})

Is it true that you cannot group or sort by summary fields??

Any clever workaround without re-doing the entire report would be good.

thanks
0
 

Author Comment

by:JMO9966
ID: 24815236
Sorry,

Maximum ({Job_Op.Sequence}, {OP_ActiveJobs_TTX.Job})
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 300 total points
ID: 24815313
Maximum is a PrintTime formula and it isn't calculated until the grouping is done.  

There is probably a way around this issue but it will involve using subreports.

Does your report have a subreport already?

mlmcc
0
 

Author Closing Comment

by:JMO9966
ID: 31598833
Thanks guys,

I added a grouping for a Date field in a Left Join table and changed the setting to Daily and moved this grouping above Job grouping and suppressed the new grouping and it looks good!
0
 
LVL 34

Expert Comment

by:James0628
ID: 24856616
I'm glad that worked out for you.  I couldn't see any way to get the Maximum thing to work.

 James
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now