Finance Business Rules

Finance business rules are integrated into Workspace assemblies to make it easier to write and maintain business rules. You can write Finance business rules using one of the finance source code service types. Developers and implementers can run the new Finance business rules in Workspace assemblies using data management jobs, BRApi, or a dashboard button server task.

The business rule name assigned can be modified on the Cubes page in the Cube Properties tab in the Business Rules section. You can also manually enter the business rule instead of selecting from the Object Lookup dialog box. To use Finance business rules in Workspace assemblies with existing business rules, you can select and copy code from one of the service types and paste it into the same arguments.

NOTE: The code examples in this section are written in C#.

Finance Service Types

These are the source code service types you can select when creating Finance business rules:

  • Finance Core Service

  • Finance Custom Calculate Service

  • Finance Get Data Cell Service

  • Finance Member Lists Service

NOTE: The cases for these finance service types have been included in the template code for new service factory files.

Copy

Finance Business Rules

 //case WsAssemblyServiceType.FinanceCore:
 // return new WsasFinanceCore();
 //case WsAssemblyServiceType.FinanceCustomCalculate:
 // return new WsasFinanceCustomCalculate();
 //case WsAssemblyServiceType.FinanceGetDataCell:
 // return new WsasFinanceGetDataCell();
 //case WsAssemblyServiceType.FinanceMemberLists:
 // return new WsasFinanceMemberLists();

These business rules are called using the following syntax:

Copy
Workspace.MyWorkspaceNameOrNSPrefix.WS

IMPORTANT: These source code types can be written in C# and VB.Net.

NOTE: The same objects are available to use with each finance service type, for example, api and args.

Finance Core Service

Finance Core service enables you to calculate functions. It contains multiple method types. These methods are called automatically by the platform from business rules assigned to the cube. This service is added to Cube Properties. You can separate functions by replacing these Select Case blocks on these types:

  • Calculate

  • Translate

  • ConsolidateShare

  • ConsolidateEliminate

  • GetCustomFxRate

  • GetConditionalInputResult ("NoInput")

Most implementers will use this service type and implement the following calculate function:

Copy

Finance Core Service

        public void Calculate(SessionInfo si, BRGlobals brGlobals, FinanceRulesApi api, FinanceRulesArgs args)
 {
 try
 {
 }
 catch (Exception ex)
 {
 throw new XFException(si, ex);

Finance Custom Calculate Service

Finance Custom Calculate service enables you to create custom calculations. It contains a method type. This service runs from a data management step. Its dedicated function is responsible for replacing Select Case blocks.

Copy

Finance Custom Calculate

namespace Workspace.__WsNamespacePrefix.__WsAssemblyName
{
    public class FinanceCustomCalculateServiceName : IWsasFinanceCustomCalculateV800
    {
 public void CustomCalculate(SessionInfo si, BRGlobals brGlobals, FinanceRulesApi api, FinanceRulesArgs args)
 {
 try
 {
 }
 catch (Exception ex)
 {
 throw new XFException(si, ex);
 }
 }
    }
}

Finance Get Data Cell Service

Finance Get Data Cell service enables you to use the GetDataCell expression in the performance section of a dynamic calculation. It contains a method type. This service is called from Cube Views. Its dedicated function is responsible for replacing Select Case blocks.

Copy

Finance Get Data Cell

namespace Workspace.__WsNamespacePrefix.__WsAssemblyName
{
    public class FBR3 : IWsasFinanceGetDataCellV800
    {
 public object GetDataCell(SessionInfo si, BRGlobals brGlobals, FinanceRulesApi api, FinanceRulesArgs args)
 {
 try
 {
 return null;
 }
 catch (Exception ex)
 {
 throw new XFException(si, ex);
 }
 }
    }
}

Finance Member Lists Service

Finance Member Lists service enables you to create a member list. It contains a method type. This service is called from Cube Views. Its dedicated function replaces Select Case blocks and removes the Headers blocks.

Copy

Finance Member List

namespace Workspace.__WsNamespacePrefix.__WsAssemblyName
{
    public class FBR4 : IWsasFinanceMemberListsV800
    {
 public MemberList GetMemberList(SessionInfo si, BRGlobals brGlobals, FinanceRulesApi api, FinanceRulesArgs args)
 {
 try
 {
 return null;
 }
 catch (Exception ex)
 {
 throw new XFException(si, ex);
 }
 }
    }
}

Dashboard Button Server Task

You can also run a Finance business rule with a Custom Calculate using a Dashboard Button Server Task.

Application Workspaces view with a Calculate button component selected. The Component Properties panel highlights the Selection Changed Server Task Arguments field, which is configured to run a custom calculate finance business rule.

Recompile

Workspace assemblies will recompile when updated or changed. The following examples indicate when a Workspace assembly will recompile with Finance business rule changes.

Example: If Workspace assembly A has a dependency on Workspace assembly B and changes are made to Workspace assembly B, then Workspace assembly A will recompile.

Example: If a Workspace assembly has a reference to a business rule and the business rule changes, then the Workspace assembly will recompile. This will then extend to the Cube View grids, where if you change a Finance business rule, the Cube View data will be marked to indicate that the underlying data and finance Workspace assembly have changed and therefore must be recalculated.

Object Lookup for Finance Business Rules

Follow these steps to view the Workspace assembly service syntax and business rules:

  1. Go to Application > Cubes > Cube Properties > Business Rules.

  2. Select the ellipsis icon. The Object Lookup dialog box displays the Workspace assembly services and business rules.

Application business rules will display in the search bar:

  1. Go to Application > Business Rules.

  2. Select the Search toolbar button to view the business rules.

Application business rules will also display in Object Lookup:

  1. Go to Application > Business Rule > Formula > code editor.

  2. Select Object Lookup to view all objects, including Workspace assembly services and application business rules under the business rules object type.

System business rules will display in the search bar:

  1. Go to System > Business Rules.

  2. Select the Search toolbar button to view the business rules.

System business rules will also display in Object Lookup:

  1. Go to System > Business Rule > Formula > code editor.

  2. Select Object Lookup to view all objects, including Workspace assembly services and application business rules under the business rules object type.

NOTE: In most locations, the OneStream Code Editor will include the Object Lookup, which will display Workspace assembly services and business rules within the business rules object type.

Create Finance Business Rules

  1. Go to Application > Presentation > Workspaces.

  2. Create an assembly, or select an existing assembly. See Create an Assembly.

  3. Create an assembly file using the Service Factory source code type. See Create an Assembly File for the Service Factory

    NOTE: The service factory file will list the Finance business rules service types.

  4. Create a new assembly file for your Finance business rule. See Create an Assembly File.

    When creating an assembly file, you must select a finance source code type: Finance Core Service, Finance Custom Calculate Service, Finance Get Data Cell Service, or Finance Member Lists Service.

  5. Configure the Workspace Service Factory code to enable your service and make updates. See Configure the Service Factory.

    IMPORTANT: The object name must match the file name.

  6. Select the Save icon to save all changes.

  7. Go to Application > Cubes > Cube Properties > Business Rules. Factories can be referenced from Cube Properties.

    TIP: The Business Rules fields are editable.

  8. Add a Workspace assembly service to the business rule.

    1. In the Business Rule field, select the Edit button.

    2. Use Object Lookup to copy the Workspace Assembly Services Syntax: Workspace.MyWorkspaceNameOrNSPrefix.WS

  9. Replace the MyWorkspaceNameOrNSPrefix placeholder text with your Workspace Name or Namespace Prefix.

  10. Select the Save icon to save the business rule to Cube Properties.