The requirement is to add the amounts of those records that have LumpChargeCode value to those records that have the corresponding ChargeCode.
Example above: add records with PriceId 2 and 3 to record A's amount.
So in the report I'd need something like this:
1 170 AAA null
4 200 BBB null
Total: 370
So far I've tried to use Arrays which I populate with values of ChargeCode, LumpChargeCode and Amounts.
Afterwards, I have 2 nested for loops to iterate through the LumpChargeCodes and ChargeCodes and add the values where the two codes match.
This is for populating the arrays:
WhileReadingRecords;
NumberVar LumpedAmountSum;
Local StringVar Key := "" & {Price.LumpChargeCode};
Local StringVar ChC := "" & {Price.ChargeCode};
Local NumberVar Amt := {Price.InvAmount};
Local NumberVar LumpedAmt := {Price.InvAmount};
StringVar array Keys;
StringVar array ChCs;
NumberVar Array Amts;
NumberVar Array LumpedAmts;
for i:= i to count(Keys) do // 1x
(
for j:= i to count(ChCs) do
(
if Keys<>'' and Keys = ChCs[j] and not ({Price.PriceItemCounter} in PriceItemCounters)
then
(
LumpedAmts[j] := LumpedAmts[j] + Amts;
redim preserve TempArray[count(TempArray)+1];
redim preserve PriceItemCounters[count(PriceItemCounters)+1];
PriceItemCounters[count(PriceItemCounters)]:= {Price.PriceItemCounter};
)
);
);
This solution does not work correctly though, as it seems that some records are added multiple times (I guess something to do with evaluation times, whilereadingrecords and whileprintingrecords)...
The fields are displayed in the detail section of the report.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum