The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
gkeushkerian
3 years agoNew Contributor II
Switch scenario, period and value members when looping data buffer cells
Hi. I am trying to forecast OpEx accounts based on a seeding method. I am storing the method on a specific month by account and some UD dimensions and based on the selected method want to apply diffe...
- 3 years ago
Basically in every loop you are:
- retrieving a very thin databuffer
- storing it into a new place
- clearing the buffer
This is memory-light (good) but network-intensive (bad).
An alternative could be:
- retrieving the buffer
- copying cells from there into a target buffer
... and then saving the buffer in one go at the end of the loop. This would be heavier in memory but much lighter on the network/database. To clarify, something like this:
Dim targetBuffer as new DataBuffer() For Each cell As DataBufferCell In driverDataBuffer.DataBufferCells.Values Select Case cell.CellAmount case 104 Dim tempBuf as DataBuffer = api.data.GetDataBufferUsingFormula("FilterMembers(....)") for each tempCell as DataBufferCell in tempBuf.DataBufferCells.Values targetBuffer.SetCell(si, new DataBufferCell(tempCell)) next ... next api.Data.SetDataBuffer(targetBuffer, destinationExpressionInfo,,, "O#Import",,,,,,,,,, True)Do your benchmarking, but I suspect this would be significantly faster.
JackLacava
OneStream Employee
3 years agoBasically in every loop you are:
- retrieving a very thin databuffer
- storing it into a new place
- clearing the buffer
This is memory-light (good) but network-intensive (bad).
An alternative could be:
- retrieving the buffer
- copying cells from there into a target buffer
... and then saving the buffer in one go at the end of the loop. This would be heavier in memory but much lighter on the network/database. To clarify, something like this:
Dim targetBuffer as new DataBuffer()
For Each cell As DataBufferCell In driverDataBuffer.DataBufferCells.Values
Select Case cell.CellAmount
case 104
Dim tempBuf as DataBuffer = api.data.GetDataBufferUsingFormula("FilterMembers(....)")
for each tempCell as DataBufferCell in tempBuf.DataBufferCells.Values
targetBuffer.SetCell(si, new DataBufferCell(tempCell))
next
...
next
api.Data.SetDataBuffer(targetBuffer, destinationExpressionInfo,,, "O#Import",,,,,,,,,, True)
Do your benchmarking, but I suspect this would be significantly faster.
Related Content
- 7 months ago
- 2 years ago