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

BCG's avatar
BCG
New Contributor II
3 years ago

Unable to populate the results into the destination intersection using GetDataBufferUsingFormula

Hi All,

I have written below rule where, I am not able to see the results, But rule is executed without any errors.

Rule is about : Writing up the source values based on the Tex1 and Tex2 assigned in the source Accounts. where Text1 & Text2 are target Intersections to to actually be written to...

Kindly help me if something is missing in the code.

Dim ResulDataBuf As DataBuffer = New DataBuffer()

Dim DestinationInfo As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo("V#Periodic")
Dim DataBufFilter As DataBuffer = api.Data.GetDataBufferUsingFormula("FilterMembers(V#Periodic,[A#[BS].Base.Where(Text1 <> vbnullstring And Text2 <> vbnullstring)])")
For Each sourceCell As DataBuffercell In DataBufFilter.DataBufferCells.Values

	Dim cashflowCell As New DataBufferCell(sourceCell) 'Temp buffercell within the loop to copy my cashflow cell

	Dim sText1 As String = api.Account.Text(cashflowCell.DataBufferCellPk.AccountId, 1) 'Source Mvmt
	Dim sText2 As String = api.Account.Text(cashflowCell.DataBufferCellPk.AccountId, 2) 'Target Account:Mvmnt.

	If (Not sText1 = vbNullString) And (Not sText2 = vbNullString) AndAlso instr(sText2, ":") > 0 Then

		Dim vSrcUD2Split As String() = Split(sText2, ":")
		Dim GetUD1Ac = Trim(vSrcUD2Split(0)) : Dim GetUD1Mvt = Trim(vSrcUD2Split(1))

		Dim vTgtActID As Integer = api.Members.GetMember(DimType.Account.Id, GetUD1Ac).MemberId
		Dim vTgtMvmntID As Integer = api.Members.GetMember(DimType.Flow.Id, GetUD1Mvt).MemberId

		cashflowCell.DataBufferCellPk.AccountId = vTgtActID
		cashflowCell.DataBufferCellPk.FlowId = vTgtMvmntID

		Dim ResultCell As New DataBuffercell(cashflowCell)

		If (Not sourceCell.CellStatus.IsNoData) Then
			ResulDataBuf.LogDataBuffer(api, "ResultCell", 100)
			ResulDataBuf.setcell(si, ResultCell, False)

		End If
	End If
Next
api.Data.setdatabuffer(ResulDataBuf, DestinationInfo) 'Save the data into destination.

4 Replies

  • JackLacava's avatar
    JackLacava
    Icon for OneStream Employee rankOneStream Employee

    I'd make sure your source databuffer is not empty, try logging that.

    • BCG's avatar
      BCG
      New Contributor II

      Thank you JackLacav for swift reply. i can see this error

      • JackLacava's avatar
        JackLacava
        Icon for OneStream Employee rankOneStream Employee

        you're filtering on View, which means the view id gets set to common, and then you never set a new one.