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

Running Totals Field using a formula and on change of field

Status
Not open for further replies.

synbios1978

Programmer
Nov 30, 2004
13
US
Crystal Reports V. 9

I am trying to create a running total for a field ARInvoiceLine.Line-Amount.

I only want the total to add when

{ARInvoiceLine.Line-Distribution} <> "Sales"

and

on the change of the field {ARInvoiceLine.Trans-Number-Invoice}

I can get one or the other to work using the radio buttons, however I do not know the formula to say to update when
"on the change of the field {ARInvoiceLine.Trans-Number-Invoice}"

If anyone could help I would appreciate it.

Thanks,

-Synbios1978
 
What does "on the change of the field {ARInvoiceLine.Trans-Number-Invoice}" mean?

Group by the {ARInvoiceLine.Trans-Number-Invoice} field.

If you only want the sum of those for each invoice where
{ARInvoiceLine.Line-Distribution} <> "Sales", try a formula in the group header or footer containing:

whileprintingrecords;
numbervar MyTotal;
if {ARInvoiceLine.Line-Distribution} <> "Sales" then
MyTotal:=MyTotal+ARInvoiceLine.Line-Amount

Now in the report footer you can reference this total by using:

whileprintingrecords;
numbervar MyTotal

-k
 
SynapseVampire,

Thanks for the answer and the information. I've played around with it, and it's working, however when I try to transfer the number to a parent report, the last value is not included with the total. (i.e. if it should be 64,000 and the last record is 3,000, I'm getting 61,000 as the answer. It's previewing fine in the subreport, so I only get the issue in sending it to the parent. I have the first formula you gave me in the header, and the shared value is in the footer.

Thanks,

Synbios1978
 
Shared value is in what footer? Group, Page, Report?

Just change the existing formulas to reflect

shared numbervar MyTotal

-k
 
Thanks again. I was trying to make it way more complicated than it needed to be. Thanks for all your help synapsevampire.

-Synbios1978
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top