How to save updated data in SaveDataEventHandler
Hello OneStream Community,
I am using the SaveDataEventHandler to validate a cell amount being saved. Depending on certain conditions I update the amount in the “args.NewDataCell.cellAmount” and set “args.Cancel = False”.
Instead of the modified amount in “args.NewDataCell.cellAmount” the original amount entered gets saved.
In the snippet of the code below, a sample error log output when a user inputs 4.3466 in a form would be:
Amount Before = 4.3466
Amount After = 4.35
But the saved amount in the form will be 4.3466.
----Snippet Start-----
BRapi.ErrorLog.LogMessage(si,"Amount Before = " & args.NewDataCell.CellAmount)
args.NewDataCell.CellAmount = Math.Round(args.NewDataCell.CellAmount, 2, MidpointRounding.AwayFromZero)
BRapi.ErrorLog.LogMessage(si,"Amount After = " & args.NewDataCell.CellAmount)
args.Cancel = False
----Snippet End-----
Please advise.