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

Group Help

Status
Not open for further replies.

AvgMoJoe

Technical User
Nov 7, 2007
26
US
Crystal 2008
MS SQL DB

Given the following data set as it comes from my query:

Capture.jpg


I am using formulas for grouping since I am reporting differently for different Xtypes.

For Xtypes 2, I'm grouping by MeasureValues indicated by Measure_ID 1600, but I need to also include those 2's with no MeasureValues indicated by a Measure_ID 1600 as "*Unspecified*".
Furthermore, I have to be careful that 2's with 1600's don't also show up on my "*Unspecified*" group where the Measure_ID differs from 1600.

My end result (without the comments) should look similar to this:

2's[tab]<value>[tab]<count>
[tab][tab]goose[tab][tab][tab]2[tab][tab][tab]// (John and Fred)
[tab][tab]chipmunk[tab][tab]1[tab][tab][tab]// (Tom)
[tab][tab]*Unspecified*[tab]2[tab][tab][tab]// (Max and Arnold)

3's[tab]<value>[tab]<count>
[tab][tab]apple[tab][tab][tab]1[tab][tab][tab]// (Dave)
[tab][tab]pear[tab][tab][tab]1[tab][tab][tab]// (Paul)

I'm having trouble including the unspecified group without including people with Measure_ID 1600 in it (because they have other Measure_ID's). I'm not sure if this is a good case to use Group Selects or formulas or whatnot....
 
if {table1.xtype} = 2
and (isnull({table3.measurevalue}) or {table3.measurevalue} = ' ')
then "*Unspecified"
else
If {table1.xtype} = 2
then {table3.measurevalue}
else
if {table1.xtype} = 3
then {table4.othervalue}
 
Assume "John" and "Tom" are unique ID's. (Obviously I tried to oversimplify my real data ;) )
(Besides not filtering for Table2.Measure_ID = 1600), this would cause John (1200 fox and 1700 wand) and Tom (1300 bear) to also be counted as "*Unspecified*", but they really have been specified as goose and chipmunk (respectively).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top