Hello everyone,
Basic Syntax is a little different than actual visual basic environment I think. There are slight modifications that I need to do.
I am trying to get invoice amounts with a data range field parameter. There are 3 different amounts in each invoice and I am trying to get the maximum of these 3 values. When I run the code below, it brings all the invoices and completely disregards this part ({?Date 2012}) .
Can anybody help me with this?
My formula is below:
Dim maxValue as Number
Dim invoiceTotal as Number
Dim invoiceAmounts(3) as Number
Dim intCount as Number
IF ({OINV.DocDate}) = ({?Date 2012}) Then
invoiceAmounts(1) = {OINV.DocTotal}
invoiceAmounts(2) = {OINV.DpmAmntSC}
invoiceAmounts(3) = {OINV.U_ABBA_DownPymt}
END IF
maxValue = invoiceAmounts(1)
FOR intCount = 2 TO 3
IF maxValue < invoiceAmounts(intCount) THEN
maxValue = invoiceAmounts(intCount)
End if
Next intCount
invoiceTotal = ({OINV.DocTotal})-{OINV.TotalExpSC}
Formula = invoiceTotal