jordielane
2 years agoNew Contributor III
Dynamic Calc - return lesser value
I'm trying to do a dynamic calc to determine lesser value of an account or 500,000. I have very little experience with vb.net so this was as far as I got but it doesn't work.
If api.Data.GetDataCell("A#RPT_Cash") > "500000" Then
Return "500000"
Else If api.Data.GetDataCell("A#RPT_Cash") < "500000" Then
Return api.Data.GetDataCell("A#RPT_Cash")
End If
Try this - then check your ErrorLog and confirm you are getting an Amount, you may need to provide additional POV to get the correct value for A#RPT_Cash.
Dim value As Decimal = api.Data.GetDataCell("A#RPT_Cash").CellAmount
Dim threshold As Decimal = 500000
Brapi.ErrorLog.LogMessage(si, "in Dynamic Calc, Entity= " & api.Pov.Entity.Name & ", value= " & value & ", threshold= " & threshold)
If value > threshold Then
Return threshold
Else
Return value
End If