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

Grouping By 1st 2 Characters 1

Status
Not open for further replies.

spacemanspiffy04

Programmer
Feb 10, 2006
24
US
Hi,

I use CR XI with DB2. I have created a report where I need to group the data by Group "A" and then by Group "B". The problem is that the field for group "B" also has some other information, so my report comes out like this:

A
B01
B02
C01
C02

I need all the Bs in one group and all the Cs in another

A
B
C

This report also has a number of other fields from multiple tables.

The other part to my question is this:

One of the fields in this report is a date field. I need to only pick up the latest date from this field. Something to the effect of Date = Maximum. I then need to display all corresponding information from all other tables only pertinent to that date field.

Any help will be greatly appreciated.

Thanks!
 
groups - create a forumula field that will contain the value and group on that.

I have a hack for the date thing - there's probably a better thing:
Main report should have a sql datasource that has a max(date), then link the value of max(date) to the subreport. The subreport have all your information. The main report would just be a dummy report that gets the max(date).

this only works if crystal is pulling the data - i'm curious to know other ways as well.
 
For the group, create a formula {@group}:

left({table.field},1)

Insert a group on this.

About the date grouping, do you want the maximum date per the {@group} you have just created? Then go to report->selection formula->GROUP and enter:

{table.date} = maximum({table.date},{@group})

-LB
 
Thanks hoho for your suggestion and for getting me started.

LB, your knowledge in this area is unbelievable! This combined with your willingness to help is something rare. I truly appreciate all the help you have given me and your willingness to spend the time looking into my questions. BTW, your suggestions on my questions worked perfectly (as they always do)!
 
good idea on the TOP group thing for Max Date! Didn't even think of it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top