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.
ChrisLoran
OneStream Employee
3 years agoYou could use a dictionary object like this, at least for the first 4 cases:
Dim dctViewToUse As New Dictionary(Of Integer,String) From { _
{101,ViewMember.Trailing3MonthAvg.Name}, _
{102,ViewMember.Trailing6MonthAvg.Name}, _
{103,ViewMember.Trailing9MonthAvg.Name}, _
{104,ViewMember.Trailing12MonthAvg.Name} }
' -- enter loop here --
' for each ... etc..
Dim strViewMemberName As String = dctViewToUse(101)
' nextRelated Content
- 7 months ago
- 2 years ago