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
Last Comment
Mike McCracken
8/22/2022 - Mon
analliah
I'm assuming that you are trying to sum the fields from the subreports and the main report into your report footer.
cozmo_troll
ASKER
Sort of; there are calculated fields using the fields from the subreports that I am trying to sum in the footer.
Mike McCracken
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
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?
analliah
mlmcc,
does this take care of all the different formula that you are adding from the different subreport.
Mike McCracken
Can you post the report to this site or one of the formulas you need totaled?
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!
Mike McCracken
In the formula {@ASP}*{@TotalQtyOnCustomerOrders}
Crystal synax
Global NumberVar MYTotal;
Local NumberVar CurrentValue;
CurrentValue := {@ASP}*{@TotalQtyOnCustomerOrders};
MyTotal := MyTotal + CurrenValue;
CurrentValue
mlmcc
cozmo_troll
ASKER
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};