Forum Discussion

MarkMeader's avatar
MarkMeader
New Contributor III
2 years ago

Workspace assemblies - Call functions from another file within the same assembly

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

  • 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.

  • JackLacava's avatar
    JackLacava
    2 years ago

    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

     

  • ChristianW's avatar
    ChristianW
    Valued Contributor

    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.

    • JackLacava's avatar
      JackLacava
      Honored Contributor

      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

       

    • RobbSalzmann's avatar
      RobbSalzmann
      Valued Contributor II

      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

       

      • ChristianW's avatar
        ChristianW
        Valued Contributor

        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.

    • MarkMeader's avatar
      MarkMeader
      New Contributor III

      Excellent thank you Christian. Makes sense to me so i will give that a try

  • RobbSalzmann's avatar
    RobbSalzmann
    Valued Contributor II

    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.

     

    • MarkMeader's avatar
      MarkMeader
      New Contributor III

      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

       

      • RobbSalzmann's avatar
        RobbSalzmann
        Valued Contributor II

        This must be V8?  I don't see the choice to reference a BR in the 7.xx versions

         

  • MarkMeader's avatar
    MarkMeader
    New Contributor III

    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.