Unable to Calculate Currency Override only for Accounts with Text Filter.
Hello All,
I am new to OneStream trying to write a Value Override business rule for some investment accounts, The rule works without account filter. How ever I want to restrict this to Accounts with Text2 tag as "CADOverride". Somehow the value becomes zero if I have the Text 2 filter and not sure where am I doing wrong, (I am currently just checking if text 2 is not null and it seems to be retuning empty)
Dim foreignCurrency As String = api.Pov.Cons.Name
If ((Not api.Entity.HasChildren()) And (api.Cons.IsForeignCurrencyForEntity())) Then
Dim overrideAcc As String = api.Account.Text(api.Pov.Account.MemberId, 2)
If String.IsNullOrEmpty(overrideAcc) Then
Select Case foreignCurrency
Case "CAD"
api.data.calculate("F#EndBal= RemoveNoData(F#CADOverrideInput:C#Local)")
End Select
End If
End If
How should I proceed to troubleshoot this?
Any ideas are appreciated,
Thanks,
Manoj
You might like to consider this example as a starting point, which looks in C#Local for any populated cells on special flows that have Alternate Currency Input , and copies those appropriate currency inputs into F#EndBal on the corresponding data unit for that translated ccy.
I recommend using the Alternate Currency Input properties of the flows, rather than assuming flow naming convention, to obtain the currency:
If Not api.Entity.HasChildren() _ AndAlso api.Cons.IsForeignCurrencyForEntity() Then Dim dataUnitCcyId As Integer = api.Cons.GetCurrency(api.Pov.Cons.MemberId).Id Dim id_EndBal As Integer = api.Members.GetMemberId(DimTypeId.Flow, "EndBal") ' --- assumes F#[OverridesParent] is the parent of all flows that have Alternate Currency Input -- Dim di As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo(String.Empty) Dim buf As DataBuffer = api.data.GetDataBufferUsingFormula("FilterMembers(C#Local,F#[OverridesParent].Base)",DataApiScriptMethodType.Calculate,False,di) Dim resultBuf As New DataBuffer() '--- now loop through the populated cells for flows that have Alternate Input currencies --- For Each bufCell As DataBufferCell In buf.DataBufferCells.Values If Not bufCell.CellStatus.IsNoData AndAlso bufCell.CellAmount <> 0 Then ' -- test if the flow member represents an alternate Input currency --- Dim AltCcyIdForFlow As Integer = api.Flow.GetAlternateInputCurrencyId(bufCell.DataBufferCellPk.FlowId) If AltCcyIdForFlow = dataUnitCcyId Then Dim resultCell As New DataBufferCell(bufCell) resultCell.DataBufferCellPk.FlowId = id_EndBal resultBuf.SetCell(si,resultCell,True) End If End If Next api.Data.SetDataBuffer(resultBuf, di)