Referencing a custom structure from a referenced assembly
I am trying to figure out how to share a structure between OS BR files.
In an Extender BR file named ExtenderBR I have:
Public Structure MyStruct
Public Element1 As String
Public Element2 As Boolean
Public Element3 As Integer
End Structure
Public Function MyFunct1() As String
Return ""
End Function
Public Function MyFunct2() As MyStruct
Return New MyStruct
End Function
In my Finance BR file, I include the BR\ExtenderBR from above and include a line
Dim ExtenderBR As New OneStream.BusinessRule.Extender.ExtenderBR.MainClass
Dim xx As String=ExtenderBR.MyFunct1() 'This works
ExtenderBR.MyFunct2() 'Generates error, as the Finance rule doesn't know about the custom Structure
Any thoughts how to share MyStruct across multiple OS Business Rules files?
It's just a namespacing issue. My code above worked because the type was not declared at compilation time, so typing information would only be (successfully) looked up at runtime; but yours wants types available at compilation time, so you have to import the namespace at the top:
Imports OneStream.BusinessRule.Extender.ExtenderBR.MainClass
That should solve your compilation issues.
(For the record, you don't need to mark "Contains Global Functions for Formulas" to go cross-rule, that option is just if you plan to actually reference it from the Member Formula properties on dimension members, something that typically only Finance rules concern themselves with.)