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

group sumarry total problem 1

Status
Not open for further replies.

huzhou81

Programmer
Nov 15, 2006
9
US
Hi all,
In my Crystal Report, I have got the following records:

Class class# JAN FEB MAR
Administrative Professionals 02222 15-16
Administrative Professionals 02222 01-02
Administrative Professionals 02222 26-27
Administrative Professionals 02222 11-12

Under Ian's suggestion, I display details in a group footer.Create group based upon class
Add class and class number to footer suppress header and details. Then in footer add Max summaries of the other fields.

Class class# JAN FEB MAR
Administrative Professionals 02222 15-16 01-02 11-12


But I need

Class class# JAN FEB MAR
Administrative Professionals 02222 15-16 01-02 26-27,11-12

Anyone know how crystal report can deal with this situation?

Thanks very much
 
Well that sort of depends on more information than you're providing.

What if you have 10 records for February, hwo would you display in that instance?

Do you really have rows with the month names in them, or are you deriving the month from a global date field?

Your example shows that you have month fields, so I would use varaiables to store the multiple rows for each month and display later, as in:

Group header:
whileprintingrecords;
stringvar Jan:="";
stringvar Feb:="";
stringvar Mar:="";

Details:
whileprintingrecords;
stringvar Jan;
stringvar Feb;
stringvar Mar;
If not(isnull({table.jan})) then
Jan:=Jan+{table.jan}+" ";
If not(isnull({table.feb})) then
Feb:=Feb+{table.feb}+" ";
If not(isnull({table.mar})) then
Mar:=Mar+{table.mar}+" ";

Group Footer:
whileprintingrecords;
stringvar Jan;

whileprintingrecords;
stringvar Feb;

whileprintingrecords;
stringvar Mar;

I suspect that you did not accurately show how the records are stored though, rather showing us some result of Ian's formulas instead, what we need to know is what is in the table(s) being returned to the report, not an example of what doesn't work.

-k
 
Create a formula that accumulates, as in:

//{@accum} to be placed in the detail section:
whileprintingrecords;
stringvar jan := jan + {table.jandayrange}+", ";
stringvar feb := feb + {table.febdayrange} + ", "; //etc.

Then create a separate display formula for each variable for the group footer:

//{@displjan}:
whileprintingrecords;
stringvar jan;
left(jan,len(jan)-2);

//{@displfeb}:
whileprintingrecords;
stringvar feb;
left(feb,len(feb)-2);

You would need a reset formula for the group header:
whileprintingrecords;
stringvar jan := "";
stringvar feb := "";

Then suppress the detail section.

-LB
 
Acutlly, the incoming records are like:

class class# StartDate EndDate category
Professionals 02222 1/15 1/16 prof
Business 0211 3/4 3/6 bus
Professionals 02222 2/01 2/02 prof
Business 0211 2/24 2/26 bus
Business 0211 2/12 2/13 bus
Professionals 02222 3/26 3/27 prof
Professionals 02222 3/11 3/12 prof
Business2 0212 1/16 1/17 bus



The end result should be



Class class# JAN FEB MAR
prof
Professionals 02222 15-16 01-02 26-27,11-12
bus
Business 0211 24-26,12-13 4-6
Business2 0212 16-17


I use two groups, first by category then by class, in group 2 footer I use max sumaries , so I got

Class class# JAN FEB MAR
prof
Professionals 02222 15-16 01-02 11-12
bus
Business 0211 12-13 4-6
Business2 0212 16-17


I do thinking about use formula in group header, but I not sure where to set the formula? Is it in Section expert?

Thank you.
 
Place my reset formula in the class group header, the {@accum} formula in the detail section, and the display formulas in the class group footer. Then suppress the detail section. For the {@accum} formula, you would just subsitute your formula that concatenates the start and enddate for the {table.daterange} as in:

whileprintingrecords;
stringvar dayrange := totext(day({table.startdate}),0,"")+"-"+ totext(day({table.enddate}),0,"");
stringvar jan;
stringvar feb;
select month({table.startdate})
case 1 : jan := jan + dayrange +", ";
case 2 : feb := feb = dayrange + ", ";
//etc.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top