API Overview Guide
API Overview Guide
8.5.0 Release
Copyright © 2024 OneStream Software LLC. All rights reserved.
Any warranty with respect to the software or its functionality will be expressly given in the
Subscription License Agreement or Software License and Services Agreement between
OneStream and the warrantee. This document does not itself constitute a representation or
warranty with respect to the software or any related matter.
OneStream Software, OneStream, Extensible Dimensionality and the OneStream logo are
trademarks of OneStream Software LLC in the United States and other countries. Microsoft,
Microsoft Azure, Microsoft Office, Windows, Windows Server, Excel, Internet Information
Services, Windows Communication Foundation and SQL Server are registered trademarks or
trademarks of Microsoft Corporation in the United States and/or other countries. DevExpress is a
registered trademark of Developer Express, Inc. Cisco is a registered trademark of Cisco
Systems, Inc. Intel is a trademark of Intel Corporation. AMD64 is a trademark of Advanced Micro
Devices, Inc. Other names may be trademarks of their respective owners.
Table of Contents
Table of Contents
Introduction 1
Development Technologies 2
Programming Language 2
User Interface Technology 2
Server Technology 3
Database Technology 3
Developer Fundamentals 4
VB.Net and C# 4
In-Solution Documentation 4
Business Rules Editor Overview 5
Helpful Resources 6
Platform Engines 8
Workflow Engine 8
Stage Engine 8
Finance Engine 9
Data Quality Engine 9
Data Management Engine 9
Presentation Engine 10
BRApi 10
Api.Pov.Entity.MemberId 63
Api.Pov.Entity.MemberId Usage 64
Api.Pov.Account.MemberId 65
Api.Pov.Account.MemberId Usage 66
Dimension Primary Key - DimPk 67
DimPK Usage 67
Dimension Type Id 69
DimTypeID Usage 70
Data Unit Dimension POV 71
Data Unit Dimension POV Usage 71
Time Functions 73
Api.Time.GetYearFromId 73
Api.Time.GetPeriodNumFromId 73
Api.Time.GetPeriodNumFromId Usage 74
Api.Time.GetNumDaysInTimePeriod 74
Api.Time.GetNumDaysInTimePeriod Usage 75
Api.Time.AddTimePeriods 76
Api.Time.AddTimePeriods Usage 76
Api.Time.AddYears 77
Api.Time.AddYears Usage 77
GetDataBuffer Functions 92
GetDataBuffer Function 93
GetDataBuffer Usage 94
Unbalanced Math Functions 96
Unbalanced Math Functions 96
Unbalanced Math Functions Usage 97
GetDataBufferUsingFormula Function 97
FilterMembers 98
GetDataBufferUsingFormula Usage 98
Introduction
The purpose of the API Guide is to provide detailed information about the technologies
and application programming interfaces available to consultants and developers
interested in extending the functionality of OneStream.
This document contains information about the technologies used in the OneStream
product, naming conventions and organizational approaches used by the OneStream
engineering team. It also includes detailed reference listings for API methods and events
exposed by OneStream.
Development Technologies
Programming Language
The OneStream platform is based on .Net Core. OneStream’s underlying codebase is
predominately made up of C# libraries with a few VB.Net libraries in use as well. C# and
Visual Basic .NET are the two primary programming languages used to code against .NET
Core. C# and VB.NET have very different syntax elements, but Microsoft developed these
languages simultaneously as part of a common .NET Core development platform. Both
C# and VB.Net are developed, managed, and supported by the same language
development team at Microsoft. They compile to the same intermediate language (IL)
which runs against the same .NET Core runtime libraries. Although programming syntax
is different for each language, almost every command in VB has an equivalent command
in C# and vice versa. Both languages reference the same underlying .NET Core Base
Classes to extend their functionality.
Server Technology
All OneStream code is hosted and executed with Microsoft Internet Information Services
(IIS). This means that both the Web Server (service code) and Application Server (service
code) are executed within an IIS Application Pool process host. The code is running on
the application server tier hosted within the application sever IIS application pool. This is
a very important concept to keep in mind because there will be times when a Business
Rule must interact with different elements of the system. The context in which the
Business Rule is running needs to be understood in order to establish communication
and/or interact with those other system elements.
Database Technology
OneStream was designed to run on all versions of the Microsoft SQL Server relational
database engine (Express, Standard, Data Center, Enterprise and Azure Database as a
Service). For larger organizations, the SQL Server Enterprise edition is recommended
because OneStream makes use of table partitioning. This enables maximum throughput
during heavily multi-threaded operations such as data transformation and consolidation.
The OneStream engineering team is committed to fully utilizing the capabilities of the
most recent versions of SQL Server and to keeping the OneStream platform optimized
for new versions of SQL Server as they become available.
Developer Fundamentals
VB.Net and C#
The OneStream platform is based entirely on .Net Core as is the Business Rules engine.
Therefore, VB.Net and C# are the logical choice for Business Rule syntax. At execution
time, all Business Rules are compiled on demand and cached for fast and reliable
execution. Writing a Business Rule in VB.Net or C# provides the end user with many
advantages over older products based on VBScript. Business Rule writers can expect
exceptional code performance, better error messaging, and better error handling
because VB.Net and C# are a full featured programming language. In the end, these
capabilities result in a more reliable Business Rule code.
NOTE: There are two broad Business Rule Classifications: Shared Business
Rules and Item Specific Business Rules. Shared Business Rules can be
written in either VB.NET or C#, Item Specific Business Rules can be written in
VB.NET only.
In-Solution Documentation
The Business Rule Editor includes context sensitive help for API properties and methods
as well as Snippets (code examples). In-solution documentation makes the process of
writing a Business Rule more efficient because both API Documentation, Objects, and
Samples are presented within the Business Rule Editor window. In addition, useful coding
examples accumulated by the OneStream engineering and consulting teams are also
presented in context sensitive manner within the Business Rule editor. Companies and
partners can author their own Snippets and include them in their application as an
The image below explains the major regions and elements of the Business Rule editor.
Helpful Resources
VB.Net
VB.Net is one of the most popular programming languages in use today. This language is
especially popular amongst business users because the syntax is perceived to be more
readable and business user friendly than other programming languages. VB.Net still
shares many of the same syntax elements of older VB dialects such as VB6, VBA and
VBScript. This means that users who have written Macros in Microsoft Excel or used
VBScript to write Business Rules in first generation CPM solutions should feel
comfortable with the core syntax elements of VB.Net. The main learning challenge
business users face when migrating to VB.Net is understanding the object oriented
nature of the language. In comparison to VBScript, VB.Net offers more elegant coding
opportunities. Many of the statements and processes are manually created in VBScript,
but in VB.Net they are encapsulated in object libraries on which users can simply call.
Getting comfortable with VB.Net takes a little awareness of the basic libraries and objects
provided by .Net Core. The link below points to some resources that business users may
find helpful during the VB.Net learning process.
https://msdn.microsoft.com/en-us/library/2x7h1hfk.aspx
C#
C family of languages and will be immediately familiar to C, C++, Java, and JavaScript
programmers.
Microsoft C# Learning
The link below points to some resources that business users may find helpful during the
C# learning process.
https://docs.microsoft.com/en-us/dotnet/csharp/
Platform Engines
The platform is comprised of multiple processing engines. These engines have distinct
responsibilities with respect to system processing and consequently they expose
different API interfaces to the Business Rules they call. This section provides a brief
overview of each engine in the platform and describes the engine’s core responsibilities.
Workflow Engine
The Workflow Engine is thought of as the controlling engine or the puppeteer. The main
responsibility of this engine is to control and track the status of the business processes
defined in the Workflow hierarchies. This engine is primarily accessed through the BRApi
and can be called from other engines in order to check Workflow status during process
execution. The Workflow Engine provides a very rich event model allowing each
Workflow process to be evaluated and reinforced with customer specific business logic
if required (see Appendix 2: Event Listing).
Stage Engine
The Stage Engine performs the task of sourcing and transforming external data into valid
analytic data points. The main responsibility of this engine is to read source data (files or
systems) and parse the information into a tabular format. This allows the data to be
transformed or mapped to valid Members defined by the Finance Engine. The Stage
Engine is an in-memory, multi-threaded engine that provides the opportunity to interact
with source data as it is being parsed and transformed. In addition to parsing and
transforming data, the Stage Engine also has a sophisticated calculation that enables
data to be derived and evaluated based on incoming source data. The Stage Engine
provides quality services to source data by validating, mapping, and executing Derivative
Check Rules.
Finance Engine
The Finance Engine is an in-memory financial analytic engine. The main responsibility of
this engine is to enrich and aggregate base data cells into consolidated multi-
Dimensional information. The Finance Engine provides the opportunity to define
sophisticated financial calculations through centralized Business Rules as well as
member specific Business Rules (Member Formulas). It works concurrently with the
Stage Engine to validate incoming intersections and works with the Data Quality Engine
to execute Confirmation Rules which are used to validate analytic data values.
engines. For example, the Clear Data Step uses the services of the Finance Engine. In
addition, the Data Management Engine has the ability to execute a Business Rule Step
which executes a custom Business Rule as part of a Data Management Sequence. This
is an incredibly powerful capability because it provides the ability to string together any
combination of predefined processing steps with custom Business Rule steps.
Presentation Engine
The Presentation Engine provides extensive data visualization services to platform. The
Presentation Engine is made up of the following component engines: Cube View Engine,
Dashboard Engine, Parameter Engine, Book Engine and Extensible Document Engine.
The Presentation Engine is responsible for managing and delivering content to the end
user as well as providing a development environment for custom user interface
elements. This engine enables OneStream MarketPlace application development
capabilities and continues to evolve with each product release. Like the Data
Management Engine, the Presentation Engine interacts with and can call the services of
all other engines in the product.
BRApi
The BRApi is common across all Business Rules, engines and APIs being run, so it is not
an engine itself. A BRApi function runs outside of the other engines and can orchestrate
certain functions from within other engines. In other words, a BRApi function be run from
one engine (for example, Parser) to tell other engines (for example, Finance) to run their
own APIs (for example, API.Data.GetDataCellUsingMemberScript). For another example,
while the API.Data.GetDataCell function is available from within the Finance engine, a
similar BRApi called GetDataCellUsingMemberScript can be run from any engine if given
Namespaces
.Net Core organizes code libraries into subject areas called Namespaces. The process
begins with identifying the Namespaces (libraries) required for the procedure being
created. Namespaces provide distinction to the objects and methods that exist in a code
library. As a best practice, Namespaces typically start with the name of the company that
created the code library. This prevents naming conflicts for objects that share a common
name, but were created by different software providers.
In an effort to keep coding syntax as terse as possible, .Net Core allows the user to
specify common Namespaces to use at the top of a Business Rule. These lines are
preceded by the key word Imports. Adding Imports Statements prevents having to type
an object’s fully qualified name within a Namespace.
All Business Rules are prepopulated with both the commonly used Microsoft
Namespaces as well as the OneStream specific Namespaces. For example, adding the
statement Imports System.Math to a Business Rule enables access to objects in the
System.Math Namespace. Instead of typing System.Math.Round(100.05,0), type Round
(100.05,0).
The example below shows the Namespace references used in a standard Extensibility
Rule.
Namespaces Defined
OneStream is a large and sophisticated software platform and consequently a great deal
of effort went into organizing the code base into a hierarchical set of Namespaces. This
section defines the Namespace hierarchy and explains the primary purpose of the code
libraries in each Namespace. It is important to understand structure and meaning of the
platform Namespaces because most API methods accept and return objects defined
within specific Namespaces. By understanding the structure of the Namespace
hierarchy, developers can browse for objects using intelli-sense in the syntax editor.
Namespace Hierarchy
The hierarchy below denotes the platform Namespaces and the object libraries
contained within them. This hierarchy is explored from within the Business Rule syntax
editor by typing OneStream. and navigating through the intelli-sense popup lists. This
technique helps find objects to pass into an API function, objects returned from an API
function, or common helper classes available in the platform.
OneStream.BusinessRule
OneStream.BusinessRule.Finance
OneStream.BusinessRule.Parser
OneStream.BusinessRule.Connector
OneStream.BusinessRule.ConditionalRule
OneStream.BusinessRule.DerivativeRule
OneStream.BusinessRule.DashboardDataSet
OneStream.BusinessRule.DashboardExtender
OneStream.BusinessRule.DashboardStringFunction
OneStream.BusinessRule.Extender
OneStream.Client
OneStream.Client.SharedUI
OneStream.Client.SharedUI.FinanceMsgStrings
OneStream.Client.SharedUI.FinanceUIStrings
OneStream.Client.SharedUI.GeneralMsgStrings
OneStream.Client.SharedUI.GeneralUIStrings
OneStream.Client.SharedUI.StageMsgStrings
OneStream.Client.SharedUI.StageUIStrings
OneStream.Client.SharedUI.StringResourceFileType
OneStream.Client.SharedUI.StringResourceHelper
OneStream.Client.SharedUI.XFStrings
OneStream.Finance
OneStream.Finance.Engine
OneStream.Finance.Engine.DataApi
OneStream.Finance.Engine.EvalDataBufferDelegate
OneStream.Finance.Engine.FinanceRulesApi
OneStream.Finance.Engine.IAccountApi
OneStream.Finance.Engine.ICalcStatusApi
OneStream.Finance.Engine.IConsApi
OneStream.Finance.Engine.ICubesApi
OneStream.Finance.Engine.IDimensionsApi
OneStream.Finance.Engine.IEntityApi
OneStream.Finance.Engine.IFlowApi
OneStream.Finance.Engine.IFunctionsApi
OneStream.Finance.Engine.IFxRatesApi
OneStream.Finance.Engine.IMembersApi
OneStream.Finance.Engine.IPovApi
OneStream.Finance.Engine.IScenarioApi
OneStream.Finance.Engine.ITimeApi
OneStream.Finance.Engine.IUDApi
OneStream.Finance.Engine.IViewApi
OneStream.Finance.Engine.IWorkflowApi
OneStream.Stage
OneStream.Stage.Engine
OneStream.Stage.Engine.Parser
OneStream.Stage.Engine.ParserDimension
OneStream.Stage.Engine.TransformerDataCache
OneStream.Stage.Engine.Transformer
OneStream.Stage.Engine.TransformerDimension
OneStream.Stage.Engine.TransformRuleCache
OneStream.Shared
OneStream.Shared.Engine
OneStream.Shared.Engine.ExternalWcfClient
OneStream.Shared.Engine.TaskActivityStepWrapperItem
OneStream.Shared.Database
OneStream.Shared.Database.DbConnInfo
OneStream.Shared.Common
OneStream.Shared.Wcf
l Depreciation
l Present and future values
l Interest rates
l Rates of return
l Payments
These functions are available to anyone with access to Business Rules. They can be
explored within the Business Rule syntax editor by typing Microsoft.VisualBasic.Financial
then navigating through the intelli-sense popup lists.
To view all methods from the Microsoft.Visual Basic Financial class used in a Business
Rule:
In-Solution Development
In-solution development is the process of creating OneStream Business Rules to deliver
domain specific solutions. This means that all Business Rules are executed within the
application server process space. The code written is only executed on the application
servers where OneStream is deployed.
Custom Development
Custom development refers to stand alone application development that interacts with
the platform at the web server tier.
The platform has the ability to display web pages within a custom Dashboard. This allows
completely custom web applications to surface within the OneStream solution.
OneStream can pass information about the user’s POV and Workflow as URL Parameters
enabling the custom web application to act as part of an integrated solution.
With this capability, developers are free to create and incorporate any solution they can
imagine.
Under each Case statement, these rules and related Args and BRApis can be used to
check the current Server Set capacity, query metrics about a Server Set or Azure
Database and impact the volume of Server Sets or level of Azure Database deployed.
Refer to the Installation and Configuration Guide under Azure Database Connection
Settings and Server Sets for where to refer to these Business Rules. Example starting
point of empty System Extender Business Rule upon creation:
Database
The Database screen allows System Administrators to view all of OneStream’s database
tables and provides tools for managing stored data and other information.
Tables
This gives read-only access to all data tables in the database and can be used for tasks
such as trying to debug issues without having access to the database, or deletion
logging.
Tools
Database Tools allow System Administrators to manage the database.
Data Records
Enter a Member Filter in order to view data for the entire system.
Event Listing
StartParseAndTransForm
InitializeTransFormer
ParseSourceData
LoadDataCacheFromDB
ProcessDerivativeRules
ProcessTransformationRules
DeleteData
DeleteRuleHistory
WriteTransFormedData
SummarizeTransFormedData
CreateRuleHistory
EndParseAndTransForm
FinalizeParseAndTransForm
StartRetransForm
EndRetransForm
FinalizeRetransForm
StartClearData
EndClearData
FinalizeClearData
StartValidateTransForm
ValidateDimension
EndValidateTransForm
FinalizeValidateTransForm
StartValidateIntersect
EndValidateIntersect
FinalizeValidateIntersect
LoadIntersect
StartLoadIntersect
EndLoadIntersect
FinalizeLoadIntersect
SubmitJournal
ApproveJournal
RejectJournal
PostJournal
UnpostJournal
StartUpdateJournalWorkflow
EndUpdateJournalWorkflow
FinalizeUpdateJournalWorkflow
SaveForm
CompleteForm
RevertForm
StartUpdateFormWorkflow
EndUpdateFormWorkflow
FinalizeUpdateFormWorkflow
StartProcessCube
Calculate
Translate
Consolidate
EndProcessCube
FinalizeProcessCube
PrepareICMatch
StartICMatch
PrepareICMatchData
EndICMatch
StartConfirm
EndConfirm
FinalizeConfirm
SaveQuestionResponse
StartSetQuestionairreState
SaveQuestionairreState
EndSetQuestionairreState
StartSetCertifyState
SaveCertifyState
EndSetCertifyState
FinalizeSetCertifyState
StartSequence
ExecuteStep
EndSequence
UpdateWorkflowStatus
WorkflowLock
WorkflowUnlock
Process Form
Process Journal
Process Workflow
Member ID
There are many functions that use MemberID as an integer to pass in as a property.
These functions get the current POV of the specific Dimension member to perform a
variety of tasks, such as:
When working with formulas and calculations, it is better to work with MemberId versus
Member Name.
Api.Pov.Time.MemberId
Api.Pov.Time.MemberId is obtained from the Time Member Id for the current POV being
executed during the calculation. The Time.MemberId is stored as an unique integer to
represent a single Time member. The uniqueness is determined by the combination of
the Year and Period.
H1 = 001
Q1 = 002
M1 = 003
M2 = 004
M3 = 005
Q2 = 006
M4 = 007
M5 = 008
M6 = 009
H2 = 010
Q3 = 011
M7 = 012
M8 = 013
M9 = 014
Q4 = 015
M10 = 016
M11 = 017
M12 = 018
l api.Time.GetYearFromId
l api.Time.GetPeriodNumFromId
l api.Time.GetNumDaysInTimePeriod
l api.Time.AddTimePeriods
l api.Time.AddYears
Api.Pov.Time.MemberId Usage
Example using api.Pov.Time.MemberId:
ErrorLog result:
Api.Pov.Entity.MemberId
Api.Pov.Entity.MemberId is obtained from the Entity Member Id for the current Entity POV
being executed during the calculation. The Entity.MemberId is stored as a unique integer
to represent a single Entity member. The Entity Member Id is also found using the Grid
View in the Entity Dimension Library.
api.Entity.GetLocalCurrencyConsMember(api.Pov.Entity.MemberId).Name
l Get value in Text Field for Dimension Members prior to executing formula
calculation.
l Example: api.Entity.Text(api.Pov.Entity.MemberId, 1)
l Get Percent Consolidation for Parent Child Relationship and specific to user
localization. Can also determine by Scenario Type and Time.
l Example: api.Entity.PercentConsolidation(api.Pov.Entity.MemberId,
api.Pov.Parent.MemberId, api.Pov.ScenarioTypeId,
api.Pov.Time.MemberId).XFToStringForFormula
l Get Percent Ownership for Parent Child Relationship and specific to user
localization. Can also determine by Scenario Type and Time.
l Example: api.Entity.PercentOwnership(api.Pov.Entity.MemberId,
api.Pov.Parent.MemberId, api.Pov.ScenarioTypeId,
api.Pov.Time.MemberId).XFToStringForFormula
Api.Pov.Entity.MemberId Usage
Example using api.Pov.Entity.MemberId:
ErrorLog Result:
Api.Pov.Account.MemberId
Api.Pov.Account.MemberId is obtained from the Account Member Id for the current
Account POV being executed during the calculation. The Account.MemberId is stored as
a unique integer to represent a single Account member. The Account Member Id is also
found using the Grid View in the Account Dimension Library.
l Example: api.Account.Text(api.Pov.Account.MemberId, 1)
Api.Pov.Account.MemberId Usage
Example using api.Pov.Account.MemberId :
ErrorLog Result:
DimPk is commonly used to identify which Dimension should be used when checking for
members as base members or descendants in a specific Dimension. DimPk is commonly
used in the following functions:
DimPK Usage
Example using DimPK :
ErrorLog Result:
Dimension Type Id
Dimension Type Id is a property of DimPk. The Dimension Type Id is a unique integer Id
that is assigned to a Dimension. The DimTypeId is found in the Dim table and the
DimTypeId represents each Dimension.
l Entity = 0
l Scenario = 2
l Account = 5
l Flow = 6
l UD1 = 9
l UD2 = 10
l UD3 = 11
l UD4 = 12
l UD5 = 13
l UD6 = 14
l UD7 = 15
l UD8 = 16
The DimTypeId is used in various functions. DimTypeId is most commonly used with the
GetMember or GetMemberId functions where the first property in the function is
DimTypeId. In this case, GetMember and GetMemberId needs to know which Dimension
Id to use for the member the function is looking for.
l Example: api.Members.GetMemberId(DimType.Account.Id,
"AcctMemberName")
DimTypeID Usage
Example using DimTypeId :
ErrorLog Result:
Because stored calculations run off Data Unit Dimensions, these Dimensions are used as
part of If Statements to execute calculations on conditions. The Data Unit Dimensions
should not be used as destination data buffers, and should not be used on the left hand
side of the equation in a api.Data.Calculate formula.
Account related Dimensions such as Account, Flow, and UD’s are not available at run-
time of the calculations. Therefore, they cannot be used in the If Statements for stored
calculations. However, they are available for Dynamic Calculations.
Run for POV and Check Member Names for Data Unit Dimensions Before Executing
Calculation:
l If api.Pov.Cube.Name.XFEqualsIgnoreCase("CubeName") Then
l If api.Pov.Entity.Name.XFEqualsIgnoreCase("EntityName") Then
l If api.Pov.Scenario.Name.XFEqualsIgnoreCase("ScenarioName") Then
l If api.Pov.Cons.Name.XFEqualsIgnoreCase("USD") Then
ErrorLog Result:
Time Functions
The following APIs are some of the most common time functions:
l api.Time.GetYearFromId
l api.Time.GetPeriodNumFromId
l api.Time.GetNumDaysInTimePeriod
l api.Time.AddTimePeriods
l api.Time.AddYears
Api.Time.GetYearFromId
This function gets the year from the current POV Time Id. It evaluates the year and then
introduces logic to execute the formula.
Api.Time.GetPeriodNumFromId
This function gets the period number from the current POV Time Id. The period is static
and is configured with either months or weeks followed by the period number. For
example: M1 – M12 or W1 – W54. It evaluates the period number and then introduces logic
to execute the formula.
Api.Time.GetPeriodNumFromId Usage
Example using api.Time.GetPeriodNumFromId :
ErrorLog Result:
Api.Time.GetNumDaysInTimePeriod
This function gets the number of days from the current POV Time Id. The number of days
are already programmed depending on the month that is selected. It evaluates the
number of days for a period and then introduces logic to execute the formula.
Api.Time.GetNumDaysInTimePeriod Usage
Example using api.Time.GetNumDaysInTimePeriod:
ErrorLog Result:
Api.Time.AddTimePeriods
This function adds time periods to the current POV Time Id. It passes that data to
different functions like GetPeriodNumFromId and then introduces logic to execute the
formula.
Api.Time.AddTimePeriods Usage
Example using api.Time.AddTimePeriods:
ErrorLog Result:
Api.Time.AddYears
This function adds years to the current POV Time Id. It passes that data to different
functions like GetYearFromId or GetPeriodNumFromId and then introduces logic to
execute the formula.
Api.Time.AddYears Usage
Example using api.Time.AddYears:
ErrorLog Result:
The following are some of the most common Member functions for calculations:
l GetMember
l GetMemberID
l GetBaseMembers
GetMember
This function gets a specific dimension member. It is used for different functions like
api.Data.FormulaVariables, GetBaseMembers function, custom member lists, and when
working with Member Id within data buffers for processes like custom consolidation.
GetMember Usage
Example using GetMember:
ErrorLog Result:
GetMemberId
This function gets a specific dimension member Id. This technique is commonly used
when working with source Data Buffers where the cells for a specific member Id need to
be changed.
GetMemberID Usage
Example using GetMemberId:
ErrorLog Result:
GetBaseMembers
This function gets base members from a specific parent member. It is commonly used
when working with Member Lists as part of FinanceFunctionType.MemberList, or to get
base members to loop through specific dimensions for api.Data.GetDataCell.
GetBaseMembers Usage
Example using GetBaseMembers:
ErrorLog Result:
Return is never seen in a Member Formula for Formula Pass. Instead of being returned,
many numbers are calculated and stored. When running a Calculation, Translation, or
Consolidation, it calls the Member Formula once for an entire Data Unit. OneStream does
not tell with which Account, Flow, or User Defined the numbers are being saved.
Initially, this may be confusing because Member Formulas are often written in an
account’s Formula property, and administrators believe OneStream will only allow that
specific Member Formula to write to that specific account. However, putting a Member
Formula in an account’s Formula property is only for organizational purposes. When
OneStream calls that formula, it is currently calculating a Data Unit and will initialize the
API engine with only the Data Unit Dimensions.
Basic stored formulas are commonly used via the Api.Data.Calculate api function.
Api.Data.Calculate is used in three different ways:
Overload Function
The most common function is Api.Data.Calculate, which sets the value of one or more
dimension values (left side of formula) equal to another (right side). Final arguments
(optional) are added to the formula for Overload Functions, Evals, and Durable Data.
The Api.Data.Calculate function must abide by the data explosion rules, which means
that the left side and the right side of the formulas are balanced with the same dimension
values on both sides. If a Member is specified for a Dimension anywhere on the right side
of the equation, you must explicitly specify something for that Dimension on the left side
of the equation.
This variation of the Api.Data.Calculate provides Member Filters (all optional) which can
be used to filter the results before saving them to the target or destination. This function
is the most powerful of the Api.Data.Calculate functions as it allows you to filter
intersections. In addition, the Eval function adds the ability to filter down the number of
individual data cells processed by data cell attributes such as CellAmount or CellStatus.
This function is commonly used to filter the source data buffer by base members of an
Account related dimension. For example, A#Sales may be the source data buffer but the
need for all products is not required for the calculation. Instead, A#Sales may need to be
calculated by the base members of Clubs. By using Clubs.Base for A#Sales, the A#Sales
data buffer has been reduced to only include Clubs.Base.
Api.Data.Calculate Usage
Example using Overload Function in a working formula:
IsDurableCalculatedData
This variation of Api.Data.Calculate lets you define whether data is durable or not. Durable
data is not cleared automatically when a Data Unit is re-calculated. It can only be cleared
by calling api.Data.ClearCalculatedData with the clearDurableCalculatedData Boolean
property set to True. As part of the standard Calculation sequence that runs during a
Calculate or Consolidate, Durable data will be ignored from processing the clear, unless
the clear is specifically defined within the Business Rule or Member Formula.
The most common reason to set the IsDurableCalculatedData to True is for seeding
purposes. As part of the first seeding, the goal may be to seed from one Scenario to
another just once and never seed it again. In this case, the seeded data should not be
cleared at any point during the Calculate or Consolidate process. This technique is
commonly used in Budget or Forecast processes where you are executing the seeding
through a Dashboard. The formula may be applied as a
FinanceFunctionType.CustomCalculate or a FinanceFunctionType.Calculate in a
Business Rule.
IsCurableCalculatedData Usage
Example using IsDurableCalculatedData in a working formula:
Eval Function
Eval has an advanced capability that lets you get at the individual Data Cells in any Data
Unit created while processing an api.Data.Calculate script. It allows Eval() to be wrapped
around a subset of the formula’s math in order to evaluate the Data Buffer that was just
created by running that math.
Prior to the 5.0 version and the introduction of the RemoveNoData function, Eval was
commonly used to evaluate individual data cells in a source data buffer to process based
on cell amount or cell status. Evaluating the number of No Data Cells for a Data Unit is an
important factor for performance and calculation efficiencies.
Eval was initially an important function to evaluate individual data cells but it has been
replaced with newer techniques such as GetDataBuffer and
GetDataBufferUsingFormula, and looping through cells within the data buffer, as well as
the Remove functions.
Summary
The Api.Data.Calculate is the easiest and simplest way to write a formula as a Member
Formula or a Business Rule. The construction of an Api.Data.Calculate formula must be
balanced on each side of the formula with the appropriate dimensions to prevent data
explosion. There are three different ways to use the Api.Data.Calculate function: Formula
with Overload, Formula with IsDurableCalculatedData, and Formula with Eval.
2. Use Remove functions whenever possible especially for sparse data models with
lots of NODATA cells.
Remove Functions
Remove Functions were introduced in the 5.0 release. They replaced the reasons to use
the Eval function. The basic need of the Eval function was to evaluate the individual data
cells within a source data buffer to apply logic for processing. In many cases, OneStream
did not want to process data cells in source data buffers that had a Cell Status of
NODATA or Cell Amount = 0. With the 5.0 release, functions do that without the need for
writing additional logic.
The RemoveNoData and RemoveZeros functions provide the ability to not process
individual data cells within a source data buffer. They wrap the Remove() around a subset
of the formula to prevent processing of individual data cells from within a source data
buffer. Remove functions are used in Member Formulas or Business Rules.
Remove functions are used for performance reasons. Data Units may contain a great
amount of NODATA data cells or 0 value data cells. These cells could be needlessly
processed during calculation execution if these functions are not used in a
Api.Data.Calculate formula.
RemoveZeros
RemoveZeros is used to remove data cells with a cell amount of 0 from the source data
buffer. In addition, this function removes data cells with a cell status of NODATA from the
source data buffer. It is important to evaluate if the 0s are needed for the
Api.Data.Calculate formula during calculation execution.
RemoveNoData
RemoveNoData removes data cells with a cell status of NODATA ONLY from the source
data buffer. Unlike the RemoveZeros function, this function does not remove data cells
with a cell amount of 0.
NODATA cells and 0 cells can be found using the following methods:
1. Review the Data Unit Statistics when you right-click on a cell in Cube View.
2. Review the Application Analysis Dashboard and check the Entity Data Statistics
Report.
This is based on the Data Unit and Entity Data Statistics. There may be many Member
Formulas and Business Rules that are driving data creation. Therefore, all formulas would
need to be evaluated to determine whether these Remove functions are used. The
higher the percentage ratio of NODATA cells to Total Number of Stored Records, the
more important it is to use these Remove functions.
Example = 3,203 Stored Records with 2,019 of those Stored Records as NODATA
cells. Nearly 65% of the Data Unit has NODATA cells to process which causes extra
calculation time.
GetDataBuffer Functions
A Member Script may not be defined for the Api.Data.Calculate function because
multiple Data Cells, which seem completely unrelated to each other, are being processed
and none of the Dimension Members are constant. For those situations, use the
GetDataBuffer and SetDataBuffer functions.
l GetDataBuffer
l GetDataBufferForCustomShareCalculation
l GetDataBufferForCustomElimCalculation
l GetDataBufferUsingFormula
l SetDataBuffer
However, when using GetDataBuffer functions, the formula may not be writing to a
specific Member. Every Data Cell saved is possibly written to a different dimension
member. In this case, the logic can be developed in a Business Rule and could be created
as a Sub routine to execute throughout Finance Business Rules.
GetDataBuffer Function
GetDataBuffer retrieves a Data Unit’s values during a particular consolidation, calculation,
or translation. When using GetDataBuffer, this is equivalent to the source data buffer or to
the right side of the equation for Api.Data.Calculate. Depending on which GetDataBuffer
function you are using, three or four properties can be used.
l ScriptMethodType As DataApiScriptMethodType
l SourceDataBufferScript As String
l ExpressionDestinationInfo As ExpressionDestinationInfo
The sourceDataBufferScript is equivalent to the right side of the equation for the
Api.Data.Calculate.
The expressionDestinationInfo is equivalent to the left side of the equation for the
Api.Data.Calculate. Frequently, this gets manipulated using the Dimension Id, passing in
the Dimension Member Id for the data buffer primary key.
The GetDataBuffer can be used in various ways, and is not limited to the following:
1. Use Data Buffers to perform Data Buffer math. In some cases, this can perform
better than an Api.Data.Calculate.
GetDataBuffer Usage
Example using GetDataBuffer with Data Buffer Math in a working formula:
Example using GetDataBuffer and SetDataBuffer in Business Rule Using Sub Routine in a
working formula:
l AddUnbalanced
l Example: api.Data.Calculate("A#TargetAccount = AddUnbalanced
(A#OperatingSales, A#DriverAccount:U2#Global, U2#Global)")
l SubtractUnbalanced
When using Unbalanced Math functions, the first two parameters represent the first and
second Data Buffers on which to perform the function. The third parameter represents
the Members to use from the second Data Buffer when performing math with every
intersection in the first Data Buffer. The math favors the intersections in the first Data
Buffer without creating additional intersections.
It is important that the dimensionality of the Target (left side of the equation) matches the
dimensionality of the first data buffer on the right side of the equation (argument 1).
Often, these functions would be used when one source data buffer is doing math with a
specific data cell intersection. This could be a rate, driver, or some data cell input.
GetDataBufferUsingFormula Function
The GetDataBufferUsingFormula function uses an entire math expression to calculate a
final data buffer. GetDataBufferUsingFormula can perform the same data buffer math as
Api.Data.Calculate, but the result is assigned to a variable, where Api.Data.Calculate
actually saves the calculated data.
GetDataBufferUsingFormula calculates multiple source data buffers first. Then, the result
of the math is stored in memory using a Formula Variable. Finally, the Formula Variable is
used anywhere within the Member Formula or Business Rule. This function is commonly
used during rule writing for Planning Business Rules using MultiplyUnbalanced,
DivideUnbalanced, Trailing functions such as trailing 12 months, and Allocations.
FilterMembers
FilterMembers change a data buffer and only include numbers for the specified
Dimensions. The first parameter is the starting data buffer. This can be a variable name or
an entire math equation in parentheses. There can be as many parameters as needed to
specify Member Filters and different Member Filters can be used for multiple Dimension
types. The resulting filtered data buffer will only contain numbers that match the
Members in the filters.
GetDataBufferUsingFormula Usage
Example using GetDataBufferUsingFormula in a working formula: