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 four finance source code types. Developers and Implementers can run the new Finance Business Rules in Workspace Assemblies using data management jobs, BRApi, or by using a dashboard button server task.
The Business Rules name assigned can be modified under the Cube Properties tab in the Business Rules section on the Cubes page. You can also manually type in the Business Rule instead of selecting from the Object Lookup dialog. 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 in the same arguments.
NOTE: The following code examples in this section are written in C#.
Finance Service Types
There are four 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 as shown below.
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:
Workspace.MyWorkspaceNameOrNSPrefix.WS
IMPORTANT: These source code types can be written in C# and VB.Net.
NOTE: The same objects are available for use with each finance service type, such as api and args.
Finance Core Service
Finance Core Service allows you to calculate functions. It contains six method types. These six 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 replacing these Select Case blocks on:
-
Calculate
-
Translate
-
ConsolidateShare
-
ConsolidateEliminate
-
GetCustomFxRate
-
GetConditionalInputResult ("NoInput")
Most Implementers will use this service type and implement the following calculate function:
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 allows you to create custom calculations. It contains one method type. This service runs from a data management step. Its dedicated function is responsible for replacing SelectCase blocks.
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 allows you to use the GetDataCell expression in the performance section of a dynamic calculation. It contains one method type. This service is called from Cube Views. Its dedicated function is responsible for replacing Select Case blocks.
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 allows you to create a member list. It contains one method type. This service is called from Cube Views. Its dedicated function replaces Select Case blocks and removes the "Headers" blocks.
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.
Recompile
Workspace Assemblies will recompile when making updates and changes to them. The following examples indicate when a Workspace Assembly will recompile with Finance Business Rules changes.
Example: If Workspace Assembly A has a dependency on Workspace Assembly B and changes are made to Workspace Assembly B, 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 has changed, and therefore must be recalculated.
Object Lookup for Finance Business Rules
The Workspace Assembly Service syntax will display in the following areas:
-
Go to Application > Cubes > Cube Properties > Business Rules. Click on ellipsis to open the Object lookup dialog box that contains the Workspace Assembly Services and Business Rules.
Application Business Rules will display in Object Lookup in the following areas:
-
Go to Application > Business Rules and select the Search toolbar button. This will list the Business Rules.
-
Go to Application> Business Rule > Formula > code editor, click on Object Lookup. This will display all objects including Workspace Assembly Services and Application Business Rules under the Business Rules Object Type.
System Business Rules will display in Object Lookup in the following areas:
-
When logging in to System > Business Rules > Search toolbar button.
-
Go to System >Business Rule > Formula > code editor, click on Object Lookup. This will display all object 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.