Forum Discussion

victortei's avatar
victortei
New Contributor III
2 months ago

Is it possible to setData using SaveDataEventHandler?

Hi everyone,

We’ve been using the SaveDataEventHandler to prevent users from submitting zero values for a specific scenario and flow. 

While the error message works perfectly in the Cube Views, we’ve encountered an issue when users try to submit a zero from Excel—no error message is displayed. From what I’ve read, error messages don’t work in Excel.

As a workaround, we’re considering a different approach: instead of throwing an error when a zero is submitted, we would save the zero as NotStored (dataCellStorageType.NotStored) and NoData (dataCellExistenceType.NoData). However, despite our efforts, we can’t get SaveData to function as expected. Has anyone encountered this issue or have any ideas?

Dim ScenarioName As String = "Actual"
Dim FlowMember As String = "USDOverrideEndBal"
 
If args.NewDataCell.DataCellPK.ScenarioId = BRApi.Finance.Members.GetMemberId(si, dimtype.Scenario.Id, ScenarioName) Then
 
    If args.NewDataCell.DataCellPK.FlowId = BRApi.Finance.Members.GetMemberId(si, dimtype.Flow.Id, FlowMember) Then
 
            If args.NewDataCell.DataCellPK.OriginId = DimConstants.Forms Then 
 
                'Check if it's Real Data
               If args.NewDataCell.CellStatus.IsRealData Then
                   'Check if it's a hard zero
                   If args.NewDataCell.CellAmount = 0 Then
                       Dim NewNumber As Decimal = 0
                       args.NewDataCell.SetData(NewNumber, dataCellExistenceType.NoData, dataCellStorageType.NotStored)
                   End If
               End If
            End If
    End If
End If
 
Return args

Thanks,

Victor

 

No RepliesBe the first to reply