09-29-2023 10:34 AM
Hi
I'm trying to find out the correct way to reference a function in another Workspace assemblies file.
For example say i have:
1) XFBR business rule assembly file (ParamHelper.Vb)
2) Dashboard Extender business rule assembly file (SolutionHelper.Vb)
I want to call a function that is in SolutionHelper.vb from my code that sits in ParamHelper.vb
In standard business rules this was easily achieved using Referenced Assemblies in the business rule property
and then adding something along the lines of this below:
Dim _MYHelper As New OneStream.BusinessRule.DashboardExtender.HPB_SolutionHelper.MainClass
Just not sure how the same is achieved using assemblies
Thank you
Solved! Go to Solution.
09-29-2023 11:15 AM
In version 8, most of the business rules will be located in the same namespace
Namespace Workspace.__WsNamespacePrefix.__WsAssemblyName
So to access classes within this namespace, just add
Imports Workspace.__WsNamespacePrefix.__WsAssemblyName
to the business rules / files that are not in this namespace
For example:
...
Imports Workspace.__WsNamespacePrefix.__WsAssemblyName
Namespace Workspace.__WsNamespacePrefix.__WsAssemblyName.BusinessRule.DashboardExtender.SolutionHelper
Public Class MainClass
...
This works as well in 7.4.x
So for all files, that are not of dashboard data set, dashboard extender, dashboard xfbr sting or Spreadsheet, business rules equivalent use this namespace.
09-29-2023 12:26 PM - edited 09-29-2023 12:26 PM
To save a bit of typing, one can import the whole namespace. For example, assuming you have a class "SomeCustomClass" defined in a DDS called "MyBR":
Imports Workspace.__WsNamespacePrefix.__WsAssemblyName.BusinessRule.DashboardDataSet.MyBR
...
Dim myObj as SomeCustomClass = new SomeCustomClass
09-29-2023 11:15 AM
In version 8, most of the business rules will be located in the same namespace
Namespace Workspace.__WsNamespacePrefix.__WsAssemblyName
So to access classes within this namespace, just add
Imports Workspace.__WsNamespacePrefix.__WsAssemblyName
to the business rules / files that are not in this namespace
For example:
...
Imports Workspace.__WsNamespacePrefix.__WsAssemblyName
Namespace Workspace.__WsNamespacePrefix.__WsAssemblyName.BusinessRule.DashboardExtender.SolutionHelper
Public Class MainClass
...
This works as well in 7.4.x
So for all files, that are not of dashboard data set, dashboard extender, dashboard xfbr sting or Spreadsheet, business rules equivalent use this namespace.
09-29-2023 11:30 AM
Excellent thank you Christian. Makes sense to me so i will give that a try
09-29-2023 11:33 AM
For example, if you have a file for the class EntityList
Namespace Workspace.__WsNamespacePrefix.__WsAssemblyName
Public Class EntityList
...
End Class
End Namespace
you can do this
...
Imports Workspace.__WsNamespacePrefix.__WsAssemblyName
Namespace Workspace.__WsNamespacePrefix.__WsAssemblyName.BusinessRule.DashboardExtender.SolutionHelper
Public Class MainClass
Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardExtenderArgs) As Object
Try
Dim EntLstHelper As New EntityList()
...
09-29-2023 11:41 AM - edited 09-29-2023 11:47 AM
Edit: My mistake, I thought the OP wanted to call a traditional DashboardExtender BR, and I see now he is wanting to reference on Assembly from another.
@ChristianW where is this documented for 7.4.x? I tried several times to get this to work. It never occurred to me nor did I find anything to direct me to use the tokens __WsNamespacePrefix and __WsAssemblyName
09-29-2023 12:10 PM - edited 09-29-2023 12:20 PM
It is based on some external documentation about namespaces and Information in the 8.0 documentation, introducing a new concept called service factory.
I had to downgrade an application and found, that I could call the files from the old business rules equivalents.
With service factory, we don't need different namespaces for different use cases anymore, it will all stay in the same namespace.
Workspace.__WsNamespacePrefix.__WsAssemblyName
Except you like to change it for other reasons.
09-29-2023 12:26 PM - edited 09-29-2023 12:26 PM
To save a bit of typing, one can import the whole namespace. For example, assuming you have a class "SomeCustomClass" defined in a DDS called "MyBR":
Imports Workspace.__WsNamespacePrefix.__WsAssemblyName.BusinessRule.DashboardDataSet.MyBR
...
Dim myObj as SomeCustomClass = new SomeCustomClass
09-29-2023 11:19 AM - edited 09-29-2023 12:44 PM
The OneStream.BusinessRule Namespace is not in scope in Referenced Assemblies. To my knowledge, it won't work to reference standard business rules from a Dashboard Assembly.
10-02-2023 03:36 AM
Thanks for commenting and although this wasnt what i was looking for i thought i would share with you as you may find it useful because It is actually possible to reference a business rule from a dashboard assembly.
1) Create a dependency with a BR type "Business Rule" and enter the name of the business rule
2) Create a new Object to the BR class in the assembly rule eg
Dim _HPBHelper As New OneStream.BusinessRule.DashboardExtender.HPB_SolutionHelper.MainClass
Note: Intellisense will not show it as being an option but it does still work
10-02-2023 08:56 AM
This must be V8? I don't see the choice to reference a BR in the 7.xx versions
10-02-2023 09:30 AM
Ah yes must have been an enhancement for v8
10-02-2023 03:27 AM
Thank you Christian and Jack.
Seems very obvious now and really i just needed to get my head into thinking of this more as a project in visual studio with namespaces than regular business rules.