SammyBee77 -
Personally I think you are doing this the hard way.
You haven't laid out the structure of your report very well but I am guessing from this formula it would look something like this
Jan Feb Mar Apr May Jun Jly Aug Sep Oct Nov Dec
UK Contract
CE Contract
UK Perm
CE Perm
Total Contract
Total Perm
UK Total
CE Total
PRS Total
This can easily be done using arrays storing the totals and the report printed in the report or Group footer if it is to be repeated under another criteria
An initialize formula to set up the arrays (only 4 arrays are required since the last 5 rows are really various sums of the first 4 rows)
@initialize (suppressed in report header)
WhilePrintingRecords;
NumberVar array UKC := [0,0,0,0,0,0,0,0,0,0,0,0];
NumberVar array CEC := [0,0,0,0,0,0,0,0,0,0,0,0];
NumberVar array UKP := [0,0,0,0,0,0,0,0,0,0,0,0];
NumberVar array CEP := [0,0,0,0,0,0,0,0,0,0,0,0];
" "; //required to make the formula legal
Now Group1 the report by FieldA
suppress Group1 header,footer and detail section
Place the following formula in the details section
@Calculation (suppressed in the detail)
WhilePrintingRecords;
NumberVar array UKC ;
NumberVar array CEC ;
NumberVar array UKP ;
NumberVar array CEP ;
IF {table.FieldA} = 138 then
UKC[month({table.date})] := UKC[month({table.date})] +
{table.value};
if {FieldA} = 139 then
CEC[month({table.date})] := CEC[month({table.date})] +
{table.value};
if {FieldA} = 137 then
KUP[month({table.date})] := KUP[month({table.date})] +
{table.value};
else if {FieldA} = 136 then
CEP[month({table.date})] := CEP[month({table.date})] +
{table.value};
Now all your calculations are done ...now it is just setting up your table in the Report footer....this is a little tedious but the formulas are easily cloned for the different months...I will show the formulas for the month of January
@Display_Jan_UKContract
WhilePrintingRecords;
NumberVar array UKC ;
UKC[1];
@Display_Jan_UKPerm
WhilePrintingRecords;
NumberVar array UKP ;
UKP[1];
@Display_Jan_CEContract
WhilePrintingRecords;
NumberVar array CEC ;
CEC[1];
@Display_Jan_UKPerm
WhilePrintingRecords;
NumberVar array CEP ;
CEP[1];
@Display_Jan_TotalContract
WhilePrintingRecords;
NumberVar array UKC ;
NumberVar array CEC ;
UKC[1] + CEC[1]
@Display_Jan_TotalPerm
WhilePrintingRecords;
NumberVar array UKP ;
NumberVar array CEP ;
UKP[1] + CEP[1]
I think you get the idea...it is just a manner of adding the appropriate array elements to get the other January totals.
The formulas as you can see are easily cloned for the other months
This is a manual crosstab report...I hate using the Crystal crosstab since I have more control this way.
If you were repeating this table over and over then the initialize formula would go in the Group header that is repeated and the crosstab would be in the footer of that group.
Hope this helps
Jim Broadbent