asked on # Sum in Report Footer; sum formula field

I have a report that includes data and shared variables from several subreports. I have all of the individual formulas working correctly, but I need to do some total fields in the report footer now. When I try to do this it either tells me that I must enter a field here or that this field can not be summed. Ideas please?

Crystal Reports

I'm assuming that you are trying to sum the fields from the subreports and the main report into your report footer.

Sort of; there are calculated fields using the fields from the subreports that I am trying to sum in the footer.

Since the formulas use SHARED variables they are calculated in the PRINTING RECORDS pass. Yhe summary functions are done in an earlier pass so they can't be used.

You will need to do the summary through formulas and variables

Add a formula to the report header to declare a global variable for the total.

WhilePRintingRecords;

Global NumberVar MyTotal := 0;

Where you have the value to be totaled

WhilePRintingRecords;

Global NumberVar MyTotal;

Shared NumberVar MyShared;

MyTotal := MyTotal + MyShared;

In the report footer

WhilePRintingRecords;

Global NumberVar MyTotal;

MyTotal

mlmcc

You will need to do the summary through formulas and variables

Add a formula to the report header to declare a global variable for the total.

WhilePRintingRecords;

Global NumberVar MyTotal := 0;

Where you have the value to be totaled

WhilePRintingRecords;

Global NumberVar MyTotal;

Shared NumberVar MyShared;

MyTotal := MyTotal + MyShared;

In the report footer

WhilePRintingRecords;

Global NumberVar MyTotal;

MyTotal

mlmcc

mlmcc,

Ok, I have the first and last part and they both show zero. However, I do not understand how to do the middle part. I'm not just needing to sum an individual Shared Var; the shared Vars are used along with other data to create totals in the data of the report; I need to sum those totals, not the individual var?

Ok, I have the first and last part and they both show zero. However, I do not understand how to do the middle part. I'm not just needing to sum an individual Shared Var; the shared Vars are used along with other data to create totals in the data of the report; I need to sum those totals, not the individual var?

mlmcc,

does this take care of all the different formula that you are adding from the different subreport.

does this take care of all the different formula that you are adding from the different subreport.

Can you post the report to this site or one of the formulas you need totaled?

mlmcc

mlmcc

This is the formula I needed totaled: {@ASP}*{@TotalQtyOnCustomerOrders}

>>@ASP's formula is: if ({@TotalQtyOnCustomerOrders}>0) then formula =(({@TotalPriceOrders}+{@TotalPriceInvoices})/{@TotalQtyOnCustomerOrders})

>>@TotalQtyOnCustomerOrders formula is:formula={@QtyOnOrder2}+{@QtyOnOrderTotal}

>>@QtyOnOrder2's formula is:WhilePrintingRecords;shared numberVar TotalQtyOnOrders

>>@QtyOnOrderTotal's formula is:WhilePrintingRecords; shared numberVar TotalQtyOnInvoices

Thank you!

>>@ASP's formula is: if ({@TotalQtyOnCustomerOrder

>>@TotalQtyOnCustomerOrder

>>@QtyOnOrder2's formula is:WhilePrintingRecords;sh

>>@QtyOnOrderTotal's formula is:WhilePrintingRecords; shared numberVar TotalQtyOnInvoices

Thank you!

In the formula {@ASP}*{@TotalQtyOnCustomerOrders}

Crystal synax

Global NumberVar MYTotal;

Local NumberVar CurrentValue;

CurrentValue := {@ASP}*{@TotalQtyOnCustomerOrders};

MyTotal := MyTotal + CurrenValue;

CurrentValue

mlmcc

Crystal synax

Global NumberVar MYTotal;

Local NumberVar CurrentValue;

CurrentValue := {@ASP}*{@TotalQtyOnCustome

MyTotal := MyTotal + CurrenValue;

CurrentValue

mlmcc

mlmcc,

I'm sorry if I am stupid and don't understand something. But, when I copy what you have above into the formula called: Gross (the original formula name that contains {@ASP}*{@TotalQtyOnCustomerOrders}) it comes up with "The remaining text does not appear to be part of the formula.

This is what the entire formula looks like, and it is in Crystal syntax:

{@ASP}*{@TotalQtyOnCustomerOrders}

Global NumberVar MYTotal;

Local NumberVar CurrentValue;

CurrentValue := {@ASP}*{@TotalQtyOnCustomerOrders};

MyTotal := MyTotal + CurrenValue;

CurrentValue

I'm sorry if I am stupid and don't understand something. But, when I copy what you have above into the formula called: Gross (the original formula name that contains {@ASP}*{@TotalQtyOnCustome

This is what the entire formula looks like, and it is in Crystal syntax:

{@ASP}*{@TotalQtyOnCustome

Global NumberVar MYTotal;

Local NumberVar CurrentValue;

CurrentValue := {@ASP}*{@TotalQtyOnCustome

MyTotal := MyTotal + CurrenValue;

CurrentValue

Never mind. I figured it out by elimnating the top line and also correcting the typo in the 2nd to last line. Thank you.

mlmcc,

could you advise one other thing quickly? I have a similar field that needs an average?

could you advise one other thing quickly? I have a similar field that needs an average?

View this solution by signing up for a free trial.

Members can start a 7-Day free trial and enjoy unlimited access to the platform.