C#Elimination

Oscar
Contributor

How does one write a calculation where the result needs to land at an intersection that includes C#Elimination. Ideally, I'd want to have a function such as:

 

 

Public Sub Book(ByVal si As SessionInfo, ByVal api As FinanceRulesApi, ByVal sourceCell As dataBufferCell, ByVal target As String, ByVal factor As Decimal)

 

 

And then call it as

 

 

Book(si,api,sourceCell,"U4#SOMECALC:C#Elimination",-0.3563523553)

 

 

1 ACCEPTED SOLUTION

JackLacava
Community Manager
Community Manager

I'm sorry, I don't think I understand - there are multiple problems with what you're trying to do.

  • C#Elimination is not a straightforward member, by default it's managed by the cube consolidation algorithm. If you're writing custom rules for it, you have to use the Custom option on the cube algorithm, and implement everything yourself - something I wouldn't recommend if you're just starting with rules.
  • Going cross-dataunit (as you want to do, by targeting a specific Consolidation member) shouldn't be done in a Member Formula on Account/Flow/UD members, but rather in a Custom Calculation function in a Finance Business Rule.
  • The left-hand side of the assignment operator "=" is not a cell, but rather a databuffer - a collection of multiple cells. You cannot target individual cells in Calculate (or rather you can, but you need the full POV with all dimensions specified, effectively creating a databuffer with 1 cell).
  • If you want to operate at the individual cell level, look up DataBuffer and DataBufferCells snippets. But I would strongly recommend to either read the book OneStream Finance Rules and Calculation Handbook by Jon Golembiewski, or come to the Financial Rules training class.

View solution in original post

5 REPLIES 5

Oscar
Contributor

so in my example, i'd want to replace U4# and C# with the provided members from sourceCell and put into a new variable (say targetCell) and execute api.Data.Calculate($"{targetCell} = sourceCell.CellAmount * factor")

JackLacava
Community Manager
Community Manager

I'm sorry, I don't think I understand - there are multiple problems with what you're trying to do.

  • C#Elimination is not a straightforward member, by default it's managed by the cube consolidation algorithm. If you're writing custom rules for it, you have to use the Custom option on the cube algorithm, and implement everything yourself - something I wouldn't recommend if you're just starting with rules.
  • Going cross-dataunit (as you want to do, by targeting a specific Consolidation member) shouldn't be done in a Member Formula on Account/Flow/UD members, but rather in a Custom Calculation function in a Finance Business Rule.
  • The left-hand side of the assignment operator "=" is not a cell, but rather a databuffer - a collection of multiple cells. You cannot target individual cells in Calculate (or rather you can, but you need the full POV with all dimensions specified, effectively creating a databuffer with 1 cell).
  • If you want to operate at the individual cell level, look up DataBuffer and DataBufferCells snippets. But I would strongly recommend to either read the book OneStream Finance Rules and Calculation Handbook by Jon Golembiewski, or come to the Financial Rules training class.

Thank You Jack! As always great insight in your replies:

Going cross-dataunit (as you want to do, by targeting a specific Consolidation member) shouldn't be done in a Member Formula on Account/Flow/UD members, but rather in a Custom Calculation function in a Finance Business Rule.

Also, in order to accomplish this the cube calculation attributes need to be updated to be custom instead of standard. I already took the business rules class but do not recall going into how it is that the cube attributes affect the Finance BR calculations that can be executed against it. I will definitely read the book you prescribe: OneStream Finance Rules and Calculation Handbook by Jon Golembiewski

Thank You! 

ChrisLoran
Valued Contributor

The [Book] function looks like a snippet from the FSK or some consultant solution, and not part of the OneStream foundation.
I assume you want to write to C#Elimination but from a calculation that is running on another C# member. You can't write to another data unit ("push" data),  you can only "pull" in Finance Rules.  So instead you can test if the calculation sequence is running on the C#Elimination member by doing this:

If api.Pov.Cons.MemberId = ConsMemberId.Elimination Then

    Book(si,api, "C#[SomeOtherConsMember]:" & sourceCell,  "U4:[SOMECALC]",  someDecimal )
End If

Thanks for the suggestion. I'm trying to address data issues / eliminations using finance business rules during consolidation to generate the necessary eliminations. There are multiple sample codes online using the some variant of the book function that is correct.

Please sign in! Oscar