Data Buffer to delete the data on the LHS (Target Account) ?????
- 3 years ago
Hi Krishna,
First off, the main api.data.calculate call isn't balanced where you have F#EndBalInput on the left side of the equation but not on the right. The right side should be A#Source:F#EndBalInput so that the data buffers align on both sides of the equation.
Second, I'm assuming that in this exercise, you are only want to modify Target intersections if the same intersection in Source has a non-zero value? If this is the case, I don't think you even need to run an Eval at all since you are using the RemoveZeros function on the right side of the equation. Target will only be updated with the Source data buffer that already excludes cells with 0 value.
Third, in the Eval sub, the line api.Data.ClearCalculatedData doesn't make sense in the context of you looping through each databuffer cell for Source account. You are basically clearing all calculated data cells for A#Target regardless of the current cell you're loop is evaluating. I think you would need to refine the member filter to include members of other dimensions so as to clear the intersection that is aligned with the source cell. For example:
For Each Cell As DataBufferCell In EventArgs.DataBuffer1.DataBufferCells.Values If Cell.CellAmount <> 0 Then Dim ud1Member as String = cell.GetUD1Name(api) Dim ud2Member as String = cell.GetUD2Name(api) api.Data.ClearCalculatedData(True,True,True,"A#Target:UD1#" & ud1Member & ":UD2#" & ud2Member) eventargs.DataBufferResult.SetCell(api.SI,cell) End If Next
Hope this helps!