Version CR9
I am trying to generate a report that details the payment of individual items. Depending on the payer, the payment amounts will vary. I would like the report to show the average payment amount along with the highest payment amount. The report is grouped by item code and invoice and the average amounts and highest amount paid is subtotaled by item code.
I first tried to use the running total function choosing the payment field as the summary field and maximum as the summary type but it seems to report the first record in the group even though there are other payments within the grouping that are higher.
I then tried creating a formula that compares the value of the current payment to the previous payment and depending on the results will return the higher value. The formula works fine until it changes to the next group. Right now, when the group changes, the formula compares the current payment to the previous payment from the last group. Is there a function to test for when the group value changes and evaluate accordingly. Below is an example of the code.
Any help with either solution would be greatly appreciated.
Thanks
Joe
I am trying to generate a report that details the payment of individual items. Depending on the payer, the payment amounts will vary. I would like the report to show the average payment amount along with the highest payment amount. The report is grouped by item code and invoice and the average amounts and highest amount paid is subtotaled by item code.
I first tried to use the running total function choosing the payment field as the summary field and maximum as the summary type but it seems to report the first record in the group even though there are other payments within the grouping that are higher.
I then tried creating a formula that compares the value of the current payment to the previous payment and depending on the results will return the higher value. The formula works fine until it changes to the next group. Right now, when the group changes, the formula compares the current payment to the previous payment from the last group. Is there a function to test for when the group value changes and evaluate accordingly. Below is an example of the code.
Code:
Global currencyVar CurrPmt :=0;
Global CurrencyVar MaxPmt := 0;
CurrPmt := {Chg_Pmt_Trans.payment_EXTENDED};
if Not OnFirstRecord then
if {Chg_Pmt_Trans.payment_EXTENDED} < previous ({Chg_Pmt_Trans.payment_EXTENDED})Then
MaxPmt := CurrPmt Else //{Chg_Pmt_Trans.payment_EXTENDED} Else
MaxPmt := previous ({Chg_Pmt_Trans.payment_EXTENDED})
Else
MaxPmt := {Chg_Pmt_Trans.payment_EXTENDED};
Any help with either solution would be greatly appreciated.
Thanks
Joe