mpavan
2 years agoNew Contributor II
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 wi...
- 2 years ago
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)