I have a Crystal 9 report in which I want to sum some column values. I cannot figure out how to get the summaries, which appear to work fine when placed BELOW the columns they're counting, to work right when placed at the top of the columns.
It's not just a matter of putting the calculated fields on top of the columns, in the group header - I already tried that.
For example, given the following report layout, where I am grouping on groupid:
I would like to have the report look like this:
I would like to have the numbers above each of the columns be the results of the formula below marked "is_type*". The number above the quantity column correctly auto sums via an inserted Crystal Summary, where I sum the myStoredProc column quantity.
Right now, I have defined the following formulas. All formulas are of type "VB Syntax".
FORMULA: createvars
LOCATED IN: report header
FORMULA: is_type1
LOCATED IN: details, as column "type1", above
FORMULA: is_type2
LOCATED IN: details, as column "type2", above
FORMULA: is_type3
LOCATED IN: details, as column "type3", above
FORMULA: resetrecords
LOCATED IN: group footer
It's not just a matter of putting the calculated fields on top of the columns, in the group header - I already tried that.
For example, given the following report layout, where I am grouping on groupid:
Code:
groupid abc123
date1 product description type1 type2 type3 qty
010105 somesillydescription 0 0 4 4
010105 somesillydescription 3 0 0 3
010105 somesillydescription 0 2 0 2
010105 somesillydescription 0 0 1 1
010105 somesillydescription 1 0 0 1
groupid xyz456
date1 product description type1 type2 type3 qty
010105 somesillydescription 1 0 0 4
010105 somesillydescription 0 2 0 3
010105 somesillydescription 3 0 0 2
010105 somesillydescription 0 2 0 1
010105 somesillydescription 1 0 0 1
I would like to have the report look like this:
Code:
groupid abc123 4 2 5 11
date1 product description type1 type2 type3 qty
010105 somesillydescription 0 0 4 4
010105 somesillydescription 3 0 0 3
010105 somesillydescription 0 2 0 2
010105 somesillydescription 0 0 1 1
010105 somesillydescription 1 0 0 1
groupid xyz456 5 4 0 9
date1 product description type1 type2 type3 qty
010105 somesillydescription 1 0 0 4
010105 somesillydescription 0 2 0 3
010105 somesillydescription 3 0 0 2
010105 somesillydescription 0 2 0 1
010105 somesillydescription 1 0 0 1
I would like to have the numbers above each of the columns be the results of the formula below marked "is_type*". The number above the quantity column correctly auto sums via an inserted Crystal Summary, where I sum the myStoredProc column quantity.
Right now, I have defined the following formulas. All formulas are of type "VB Syntax".
FORMULA: createvars
LOCATED IN: report header
Code:
global type1 as number
global type2 as number
global type3 as number
formula = " "
FORMULA: is_type1
LOCATED IN: details, as column "type1", above
Code:
whileprintingrecords
global type1 as number
if {myStoredProc.WidgetType} = "type1" then
type1 = type1 + {myStoredProc.quantity}
formula = {myStoredProc.quantity}
else
type1 = type1 + 0
formula = 0
end if
FORMULA: is_type2
LOCATED IN: details, as column "type2", above
Code:
whileprintingrecords
global mytype2 as number
if {myStoredProc.WidgetType} = "type2" then
mytype2 = mytype2 + {myStoredProc.quantity}
formula = {myStoredProc.quantity}
else
mytype2 = mytype2 + 0
formula = 0
end if
FORMULA: is_type3
LOCATED IN: details, as column "type3", above
Code:
[tt]
whileprintingrecords
global type3 as number
if {myStoredProc.WidgetType} = "type1" then
type3 = type3 + {myStoredProc.quantity}
formula = {myStoredProc.quantity}
else
type3 = type3 + 0
formula = 0
end if
[/tt]
FORMULA: resetrecords
LOCATED IN: group footer
Code:
whileprintingrecords
global type1 as number
global type2 as number
global type3 as number
type1 = 0
type2 = 0
type3 = 0
formula = " "