Hi all,
I've been staring at this block of code now for 4+ hours, and I don't get it.
I have created a payment subtable, with the values of PdHere or PdDir to determine payments made to our office, or to our clients' office.
All I want to do is come up with a total of the payments made here and there to work out a balance.
I've liberally used WriteLn to check my results. I've confirmed my count of the number of payment items (vCount) is correct. However, it's repeating the first value on the subtable.
For example, if I have three payments of $10, $50, and $5, the sum it calculates is $30 (counting three payments, but repeatedly adding the first value of $10, $10, and $10).
Can anyone see what I'm missing here?
Thanks.
Blair
// Give Total Collected
vRecord = 1
vCount = @FormResultSetTotal("Pmt Data")
vPdHere = 0
vPdDir = 0
if vCount >0 then
{
While vRecord <= vCount
{
vPdHere = @TM(vPdHere) + @TM(@FormFieldValue("Pmt Data", "PdHere", vRecord))
vPdDir = @TM(vPdDir) + @TM(@FormFieldValue("Pmt Data", "PdDir", vRecord))
vRecord = vRecord + 1
}
DBPd = vPdHere + vPDDir
}