Forum Discussion

jordielane's avatar
jordielane
New Contributor III
2 years ago

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...
  • MikeG's avatar
    2 years ago

    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