You haven't provided much info. If you create the summary in a SQL expression, you can group by it. If your intent is really just to order groups based on a summary field, you could alternatively use group sort.
The formula is adding the number of students in each course section. Current grouping is: course, school yr, section. We are looking to group by several ranges for the enrollment count (1 - 4, 5 - 9, 10 - 14 up to 30+.
Here is the query:
SELECT "course"."course", "crssect"."sch_yr", "crssect"."semester", "crssect"."timedesc", "course"."level_", "nmcrs"."course", "nmcrs"."section", "course"."transfer", "nmcrs"."crs_txt", "course"."dept_cod", "nmcrs"."soc_sec"
FROM ("Eurekadb"."dbo"."nmcrs" "nmcrs" INNER JOIN "Eurekadb"."dbo"."course" "course" ON "nmcrs"."course"="course"."course") INNER JOIN "Eurekadb"."dbo"."crssect" "crssect" ON "nmcrs"."sid"="crssect"."sid"
WHERE "course"."course" NOT LIKE 'ATH%' AND ("crssect"."sch_yr"='200708' OR "crssect"."sch_yr"='200809' OR "crssect"."sch_yr"='200910') AND ("crssect"."semester"='1' OR "crssect"."semester"='2') AND NOT ("crssect"."timedesc" LIKE 'ARR' OR "crssect"."timedesc" LIKE 'TBD') AND "course"."transfer"=0
ORDER BY "course"."course", "crssect"."sch_yr", "nmcrs"."section", "nmcrs"."course
Use the group Sort feature. Select the group and the summary you want to sort the groups by.
It might be listed under TopN Sort Group Expert.
It can group by any summary. it can't group by formulas based on a sumamry although we've found a way to do this, and covered this in the latest Crystal Clear newsletter.
Thanks for the help and the link to the Crystal Clear newsletter! I couldn't get it to work (I'm using a count for the summary) but learned some new things about Crystal.
Are the section IDs (sid?) unique? In other words, is a section ID used in only one course in one year? And are you looking just for the enrollment count within sections?
Well, I'm not sure which sid field to use, but try something like this for a SQL expression {%cnt}:
(
select count("soc_sec")
from "Eurekadb"."dbo"."nmcrs" A
where A."sid" = "nmcrs"."sid"
)
...where I'm assuming "soc_sec" will act as a unique student ID and where "sid" = the section ID. If that isn't correct, substitute the correct field names. Then I would place this on the report and check for accuracy before using it in a formula in the formula editor like this:
select {%cnt}
case 1 to 4 : "01 - 04"
case 5 to 9 : "05 - 09"
etc//
default : 0
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.