Source Code Types
When you create an assembly file, you must choose a source code type. This populates the Business Rule Type property inside the rule. You can choose from two source code types: Business Rule types and Service types.
There are several duplications between Service types and Business Rule types, which provides a choice on how you write rules in assemblies. For example, the XFBR String Service and the Dashboard String Function business rule both function the same. In some cases, you might realize slight performance gains when using Service types as they offer more flexibility.
Business Rule Types
There are two ways to create the various business rule types (cube view extenders, XFBR strings, dashboard extenders, spreadsheets, or data sets):
-
Choosing a business rule type when the assembly is created.
In this section, you will learn more about the first option as this is more familiar to developers who have written business rules in OneStream. However, the recommended action for solution developers is to use the second option due to performance impacts.
Regardless of the option you choose, it is important to be aware of the slight differences when calling rules created as assemblies versus calling business rules.
Dashboard String Function Business Rules in Assembly Files
The following examples of an XFBRString were created as files within assemblies. These types of rules are often referenced throughout the application to more finely tune formatting and display options. These business rules are usually called using the following syntax:
XFBR(RuleName, FunctionName)
However, if this XFBR was created as an assembly, it would look like this:
XFBR(Workspace.WorkspaceName.AssemblyName.FileName, FunctionName)
More information is required to call this rule to ensure correctness, such as:
XFBR(Workspace.MNExamples.New.TestRule, SayHello) or XFBR(Workspace.Current.New.TestRule, SayHello)
For workspace name, you can use the word "Current" to refer to the workspace you are currently in. This is useful when you are referencing rules within objects created in each workspace.
XFBR(Workspace.Current.AssemblyName.FileName, FunctionName)
To call an XFBR workspace assembly rule, use this syntax and replace "Current" with the actual workspace name.
-
Name of the workspace
-
Name of the assembly
-
Name of the assembly file
-
Source code
NOTE: If you are not using “Current” as the workspace name you must have the Is Shareable Workspace property set to True, even if you are referencing the rule within the same workspace. If you do not do this, your rule will not run.
Dashboard Extender Business Rules in Assembly Files
In the following example, when a button is clicked, a dashboard extender rule completes the selected workflow profile.
Typical syntax for this rule written in the business rules page would be:
{MyDashboardExtenderBRName}{MyFunction}{Param1=[MyValue1], Param2=[MyValue2]}
Because this is an assembly, however, the rule is modified to provide more specific syntax:
{Workspace.WorkspaceName.AssemblyName.FileName}{MyFunction}{Param1=[MyValue1], Param2=[MyValue2]}
Dashboard Data Set Business Rules in Assembly Files
In this example, a Method Query Data Adapter is referencing a business rule. However, because this was created as an assembly file, appropriate syntax must be used. This type of business rule is typically called with the following syntax:
{MyDataSetBRName}{DataSetName}{Param1=[MyValue1], Param2=[MyValue2]}
Because this is an assembly, it has to be modified:
{Workspace.WorkspaceName.AssemblyName.FileName}{DataSetName}{Param1=[MyValue1], Param2=[MyValue2]}
Spreadsheet Business Rules in Assembly Files
Business rule names are typically chosen by clicking the ellipsis icon in the spreadsheet:
However, if you have created the spreadsheet rule as an assembly file, you will notice that the rule cannot be found by clicking the ellipsis icon. The spreadsheet assembly can still be referenced using the business rules syntax:
Workspace.WorkspaceName.AssemblyName.FileName
Cube View Extender Business Rules in Assembly Files
Cube view extender rules are commonly used to fine-tune formatting of cube views. You can write these rules directly on a cube view, from the Business Rules page, or through assemblies. These rules run only on the PDF version of the cube view.
To reference a cube view extender rule that was created as an assembly, you should set the cube view custom report task to "Execute Cube View Extender Business Rule." Refer to the rule using the following syntax:
Workspace.WorkspaceName.AssemblyName.FileName
Do not use the ellipsis icon to select a business rule in this case, as this only provides rules present in the Business Rules page.