0% found this document useful (0 votes)
10 views105 pages

API Overview Guide

The API Overview Guide provides detailed information on the technologies and application programming interfaces available for extending OneStream functionality, including programming languages, user interface technology, and server/database technologies. It outlines the structure and organization of the API, including namespaces and various platform engines, such as the Workflow Engine and Finance Engine. The document serves as a comprehensive resource for developers and consultants working with OneStream software.

Uploaded by

Matt Spencer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views105 pages

API Overview Guide

The API Overview Guide provides detailed information on the technologies and application programming interfaces available for extending OneStream functionality, including programming languages, user interface technology, and server/database technologies. It outlines the structure and organization of the API, including namespaces and various platform engines, such as the Workflow Engine and Finance Engine. The document serves as a comprehensive resource for developers and consultants working with OneStream software.

Uploaded by

Matt Spencer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 105

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 Overview Guide i


Table of Contents

API Structure and Organization 12


Namespaces 12
Namespaces Defined 13
Namespace Hierarchy 13
Microsoft Financial Calls 17
In-Solution Development 18
Custom Development 19
Using System Tools 20
System Business Rules 20
Database 21
Tables 21
Tools 22
Data Records 22
Event Listing 23
Event Handler Business Rules 23
Event Firing Sequences 27
Finance Functions APIs 59
Member ID 60
Api.Pov.Time.MemberId 60
Api.Pov.Time.MemberId Usage 62

API Overview Guide ii


Table of Contents

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

API Overview Guide iii


Table of Contents

Using Member Functions for Calculations 78


GetMember 78
GetMember Usage 78
GetMemberId 79
GetMemberID Usage 79
GetBaseMembers 80
GetBaseMembers Usage 80
Writing Stored Calculations 82
Overload Function 83
Api.Data.Calculate Usage 84
IsDurableCalculatedData 84
IsCurableCalculatedData Usage 84
Eval Function 85
Eval Function Usage 85
Summary 87
Remove Functions 88
RemoveZeros 88
RemoveNoData 89
Remove Functions Usage 90

API Overview Guide iv


Table of Contents

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

API Overview Guide v


Introduction

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.

For customers in a OneStream-hosted environment, see the Identity and Access


Management Guide for information about authentication with OneStream IdentityServer
and using personal access tokens (PATs).

API Overview Guide 1


Development Technologies

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.

User Interface Technology


The OneStream user interface is based on the Windows Presentation Foundation (WPF)
in order to provide a truly rich end user experience. WPF employs XAML, an XML based
language, to define and link various interface elements. WPF applications can be
deployed as standalone desktop programs, or hosted as an embedded object in a
website. Windows 10 Store application development provides another opportunity for
WPF based applications to be deployed, but as Windows only applications.

API Overview Guide 2


Development Technologies

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.

API Overview Guide 3


Developer Fundamentals

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

API Overview Guide 4


Developer Fundamentals

extension of the OneStream predefined Snippets (Snippet Editor MarketPlace Solution


required).

Business Rules Editor Overview


The Business Rule editor is a powerful in-solution screen that provides integrated API
context help, syntax editing with intelli-sense, and full outlining capabilities. The actual
syntax content and Business Rule structure will be discussed at length in subsequent
sections of this document.

The image below explains the major regions and elements of the Business Rule editor.

API Overview Guide 5


Developer Fundamentals

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.

Microsoft VB.Net Learning

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.

Microsoft Visual Basic

https://msdn.microsoft.com/en-us/library/2x7h1hfk.aspx

C#

C# (pronounced "See Sharp") is a modern, object-oriented, and type-safe programming


language. This language is especially popular amongst developers as it enabled them to
build many types of secure and robust applications that run in .NET. C# has its roots in the

API Overview Guide 6


Developer Fundamentals

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/

API Overview Guide 7


Platform Engines

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

API Overview Guide 8


Platform Engines

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.

Data Quality Engine


The Data Quality Engine is responsible for controlling data confirmation and certification
processes. This Confirmation Engine is used to define and control the sequence of data
value checks required to assert the information submitted from a source system is
correct. The Certification Engine is responsible for managing user certifications and
determining the Workflow dependents’ completion status. This engine is primarily
accessed through the BRApi and may be called from other engines in order to check
data quality status during process execution.

Data Management Engine


The Data Management Engine provides task automation services to the platform. This
engine executes batches of commands that are organized into sequences which
contain steps. Steps represent entry points or mechanisms to execute features of other

API Overview Guide 9


Platform Engines

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

API Overview Guide 10


Platform Engines

the appropriate arguments. A common use is BRApi.ErrorLog.LogMessage from any


engine.

API Overview Guide 11


API Structure and Organization

API Structure and Organization

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.

API Overview Guide 12


API Structure and Organization

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 (Root Namespace)

OneStream.BusinessRule

API Overview Guide 13


API Structure and Organization

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

API Overview Guide 14


API Structure and Organization

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

API Overview Guide 15


API Structure and Organization

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

API Overview Guide 16


API Structure and Organization

OneStream.Shared.Common.(Various Constants, Helper Classes & Data


Transfer Objects ‘DTO’ )

OneStream.Shared.Wcf

OneStream.Shared.Wcf.(Various Constants & Data Transfer Objects


‘DTO’)

Microsoft Financial Calls


Financial calls are part of the Microsoft.VisualBasic namespace, and can be used to for
calculations such as:

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:

1. Navigate to the Business Rule Editor:

1. In the OneStream Software application, click the Application tab.

2. Under Tools, click Business Rules.

API Overview Guide 17


API Structure and Organization

3. Expand the appropriate Business Rules category or click Search on the


toolbar.

2. Click the Formula tab.

3. In the editor window, type Microsoft.Visualbasic.Financial.

A list of methods displays.

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

API Overview Guide 18


API Structure and Organization

application server process space. The code written is only executed on the application
servers where OneStream is deployed.

Developing within the application server environment enables solution developers to


focus on the business problem instead of common programming concerns. The
platform takes care of managing connections, moving data between application tiers,
and load balancing server activities.

In some cases, in-solution development is seen as a limitation because the developer is


restricted to coding within the application server tier. However, in most cases the
efficiency and quality gained by developing within the platform out ways any limitations
imposed by coding at the application server tier.

Custom Development
Custom development refers to stand alone application development that interacts with
the platform at the web server tier.

Custom Web Development

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.

API Overview Guide 19


Using System Tools

Using System Tools

System Business Rules


System Extender Business Rules are used in coordination with Azure Server Sets for
elastic scalability at the Azure Database and Server Sets level. Server and eDTU scaling
can be accomplished manually or via System Business Rules. If System Business Rules is
selected as a Scaling Type, then OneStream will call a user-defined System Extender
Business Rule to determine if scaling is needed. The user is responsible for implementing
the scaling function and returning the proper scaling object to OneStream. This can be
accomplished by adding a System Extender Business Rule and assigning it appropriately.

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:

API Overview Guide 20


Using System Tools

Sample System Business Rule


Metrics data is passed to this function to help the user determine whether the server or
database needs to be scaled or not. Depending on what is being scaled, different metric
data is passed in. For server scaling, Environment metrics and Scale Set metrics are
passed in to help determine scaling. For database scaling, Environment metrics and SQL
Server Elastic Pool metrics are passed in to help determine scaling.

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.

API Overview Guide 21


Using System Tools

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.

API Overview Guide 22


Event Listing

Event Listing

Event Handler Business Rules


WCF Event Handler
This allows direct interaction with the Microsoft Windows Communication Foundation
which means it listens to communication between the client and the web server. The rule
will intercept the communication, analyze it, and if certain criteria is met, it will run its logic.
This is quite flexible and has a variety of uses such as creating, reading, deleting, and
updating different types of objects in the system for users in a group or Transformation
Rule changes. For example, a rule can be created to e-mail an auditor about every
metadata change as it happens.

Transformation Event Handler


This can be run at various points from Import through Load. Available operations:

StartParseAndTransForm

InitializeTransFormer

ParseSourceData

LoadDataCacheFromDB

ProcessDerivativeRules

ProcessTransformationRules

DeleteData

DeleteRuleHistory

WriteTransFormedData

API Overview Guide 23


Event Listing

SummarizeTransFormedData

CreateRuleHistory

EndParseAndTransForm

FinalizeParseAndTransForm

StartRetransForm

EndRetransForm

FinalizeRetransForm

StartClearData

EndClearData

FinalizeClearData

StartValidateTransForm

ValidateDimension

EndValidateTransForm

FinalizeValidateTransForm

StartValidateIntersect

EndValidateIntersect

FinalizeValidateIntersect

LoadIntersect

StartLoadIntersect

EndLoadIntersect

FinalizeLoadIntersect

API Overview Guide 24


Event Listing

Journals Event Handler


This can be run before, during, or after a Journal operation such as Submission, Approval,
or Post. Available operations:

SubmitJournal

ApproveJournal

RejectJournal

PostJournal

UnpostJournal

StartUpdateJournalWorkflow

EndUpdateJournalWorkflow

FinalizeUpdateJournalWorkflow

Save Data Event Handler


This is run in order to track all save events in an application.

Forms Event Handler


This can be run before, during, or after an operation such as Form Save. Available
operations:

SaveForm

CompleteForm

RevertForm

StartUpdateFormWorkflow

EndUpdateFormWorkflow

FinalizeUpdateFormWorkflow

API Overview Guide 25


Event Listing

Data Quality Event Handler


This can be run before, during, or after data quality events like Confirmation and
Certification. Available operations:

StartProcessCube

Calculate

Translate

Consolidate

EndProcessCube

FinalizeProcessCube

PrepareICMatch

StartICMatch

PrepareICMatchData

EndICMatch

StartConfirm

EndConfirm

FinalizeConfirm

SaveQuestionResponse

StartSetQuestionairreState

SaveQuestionairreState

EndSetQuestionairreState

StartSetCertifyState

SaveCertifyState

API Overview Guide 26


Event Listing

EndSetCertifyState

FinalizeSetCertifyState

Data Management Event Handler


This can be run before or after a Data Management Sequence or Step runs. Available
operations:

StartSequence

ExecuteStep

EndSequence

Workflow Event Handler


This can be run before or after a Workflow execution step. Available operations:

UpdateWorkflowStatus
WorkflowLock
WorkflowUnlock

Event Firing Sequences


OneStream fires a series of events when completing tasks via Event Handler Business
Rules. The example below explains how to read the table which provides the firing
sequence when running a specific task.

API Overview Guide 27


Event Listing

Clear Cube Data

API Overview Guide 28


Event Listing

API Overview Guide 29


Event Listing

Clear Stage Data

API Overview Guide 30


Event Listing

API Overview Guide 31


Event Listing

Execute Data Management

Import Data Connection

API Overview Guide 32


Event Listing

API Overview Guide 33


Event Listing

Import Excel File

API Overview Guide 34


Event Listing

API Overview Guide 35


Event Listing

API Overview Guide 36


Event Listing

API Overview Guide 37


Event Listing

API Overview Guide 38


Event Listing

API Overview Guide 39


Event Listing

Import Text File

API Overview Guide 40


Event Listing

API Overview Guide 41


Event Listing

API Overview Guide 42


Event Listing

Process Form

API Overview Guide 43


Event Listing

API Overview Guide 44


Event Listing

Process Journal

API Overview Guide 45


Event Listing

API Overview Guide 46


Event Listing

Process Workflow

API Overview Guide 47


Event Listing

API Overview Guide 48


Event Listing

API Overview Guide 49


Event Listing

API Overview Guide 50


Event Listing

API Overview Guide 51


Event Listing

API Overview Guide 52


Event Listing

API Overview Guide 53


Event Listing

API Overview Guide 54


Event Listing

API Overview Guide 55


Event Listing

API Overview Guide 56


Event Listing

API Overview Guide 57


Event Listing

API Overview Guide 58


Finance Functions APIs

Finance Functions APIs

API Overview Guide 59


Member ID

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:

l Get Current Year based on Time POV


l Example: Api.Time.GetYearFromId(api.Pov.Time.MemberId)
l Get Text field value from Entity POV
l Example: Api.Entity.Text(api.Pov.Entity.MemberId, 1)
l Get Account Type based on current Account POV
l Example: Api.Account.GetAccountType(api.Pov.Account.MemberId)

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.

API Overview Guide 60


Member ID

H1 = 001

Q1 = 002

M1 = 003

M2 = 004

M3 = 005

Q2 = 006

M4 = 007

M5 = 008

M6 = 009

H2 = 010

API Overview Guide 61


Member ID

Q3 = 011

M7 = 012

M8 = 013

M9 = 014

Q4 = 015

M10 = 016

M11 = 017

M12 = 018

The Time MemberId is constructed like this: 2019003000

The api.Pov.Time.MemberId is used as a property in many functions. Here are some of


the most common functions:

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 Overview Guide 62


Member ID

Example using api.Pov.Time.MemberId in a working formula:

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.Pov.Entity.MemberId is used as a property in many functions. Here are some of the


most common functions:

API Overview Guide 63


Member ID

l Get Local Currency Id for current Entity POV.


l Example: api.Entity.GetLocalCurrencyId(api.Pov.Entity.MemberId)
l Get Local Currency Cons Member Name for current Entity POV.
l Example:

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 Overview Guide 64


Member ID

Example using api.Pov.Entity.MemberId in a working formula:

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.

Api.Pov.Account.MemberId is used as a property in many functions. Here are some of the


most common functions:

API Overview Guide 65


Member ID

l Get Account Type based on current Account POV


l Example: api.Account.GetAccountType(api.Pov.Account.MemberId)
l Get value in Text Field for Dimension Members prior to executing formula
calculation

l Example: api.Account.Text(api.Pov.Account.MemberId, 1)

Api.Pov.Account.MemberId Usage
Example using api.Pov.Account.MemberId :

ErrorLog Result:

Example using api.Pov.Account.MemberId in a working formula:

API Overview Guide 66


Dimension Primary Key - DimPk

Dimension Primary Key - DimPk


DimPk is known as Dimension Primary Key. This is a unique primary key that is assigned
to Dimensions when they are created. It is a combination of the DimTypeId and the DimId.

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:

l Get Dimension Primary Key of a Specific Dimension


l Example: api.Dimensions.GetDim("UD1DimName").DimPk
l Check if it is a Base Member of a Specific Ancestor
l Example: api.Members.IsBase(dimPk, ancestorMemberId, baseMemberId,
dimDisplayOptions)

l Get Base Members of Parent from GetMember


l Example: api.Members.GetBaseMembers(api.Pov.UD1Dim.DimPk,
parent.MemberId, Nothing)

DimPK Usage
Example using DimPK :

ErrorLog Result:

API Overview Guide 67


Dimension Primary Key - DimPk

Example using api.Pov.UD1Dim.DimPk in a working formula:

API Overview Guide 68


Dimension Type Id

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.

API Overview Guide 69


Dimension Type Id

l Get a specific Member in a specific Dimension


l Example: api.Members.GetMember(DimType.Account.Id,
"AcctMemberName")
l Get Member Id for a specific Member in a specific Dimension

l Example: api.Members.GetMemberId(DimType.Account.Id,
"AcctMemberName")

DimTypeID Usage
Example using DimTypeId :

ErrorLog Result:

Example using DimType.Account.Id in a working formula:

API Overview Guide 70


Data Unit Dimension POV

Data Unit Dimension POV


Stored calculations run based on the Data Unit POV. The Data Unit Dimension consists of
Cube, Entity, Parent, Consolidation, Time, and Scenario.

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

Data Unit Dimension POV Usage


Example using api.Pov.Entity.Name :

ErrorLog Result:

API Overview Guide 71


Data Unit Dimension POV

Example using api.Pov.Entity.Name in a working formula:

API Overview Guide 72


Time Functions

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

API Overview Guide 73


Time Functions

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:

Example using api.Time.GetPeriodNumFromId in a working formula:

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

API Overview Guide 74


Time Functions

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:

Example using api.Time.GetNumDaysInTimePeriod in a working formula:

API Overview Guide 75


Time Functions

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:

Example using api.Time.AddTimePeriods in a working formula:

API Overview Guide 76


Time Functions

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:

Example using api.Time.AddYears in a working formula:

API Overview Guide 77


Using Member Functions for Calculations

Using Member Functions for Calculations


Calculation Member functions are commonly used through the Finance Api’s for
accessing general information for any specified Member within a dimension. The
Member functions allow a rule writer to identify members, get member information, and
identify base and parent members to execute within Member Formulas and Business
Rules.

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:

API Overview Guide 78


Using Member Functions for Calculations

Example using GetMember in a working formula:

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:

Example using GetMemberId in a working formula:

API Overview Guide 79


Using Member Functions for Calculations

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:

API Overview Guide 80


Using Member Functions for Calculations

Example using GetBaseMembers in a working formula:

API Overview Guide 81


Writing Stored Calculations

Writing Stored Calculations


When writing a Member Formula or a Business Rule for a Stored Calculation, the new
calculated numbers store data for that Cube, Entity, Parent, Cons, Scenario, and Time
combination. For example, a Data Unit.

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:

l Api.Data.Calculate using Formula as String, Overload Functions, Eval Function,


and IsDurableCalculatedData

l Api.Data.Calculate using Formula as String and IsDurableCalculatedData

API Overview Guide 82


Writing Stored Calculations

l Api.Data.Calculate using Formula as String and Eval Function

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 Overview Guide 83


Writing Stored Calculations

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:

API Overview Guide 84


Writing Stored Calculations

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.

Eval Function Usage


Example using Eval in a working formula:

API Overview Guide 85


Writing Stored Calculations

API Overview Guide 86


Summary

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.

From a performance perspective:

1. Never use the Api.Data.Calculate in a loop when using variables.

2. Use Remove functions whenever possible especially for sparse data models with
lots of NODATA cells.

3. GetDataBuffer and GetDataBufferUsingFormula may have a better performance


impact. Try replacing Api.Data.Calculate when doing math with GetDataBuffer
math. In some cases, performance is better by using GetDataBuffer functions in
place of Api.Data.Calculate.

API Overview Guide 87


Remove Functions

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.

API Overview Guide 88


Remove Functions

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.

The Review functions can be found in Key Functions under Snippets.

API Overview Guide 89


Remove Functions

Remove Functions Usage


Example using RemoveZeros in a working formula:

API Overview Guide 90


Remove Functions

Example using RemoveNoData in a working formula:

API Overview Guide 91


GetDataBuffer Functions

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.

GetDataBuffer and SetDataBuffer are more fundamental than using an Eval


function. They allow you to read numbers using a Member Script, process or modify each
cell in the result, and then save the changes. Common GetDataBuffer functions include:

l GetDataBuffer
l GetDataBufferForCustomShareCalculation
l GetDataBufferForCustomElimCalculation

l GetDataBufferUsingFormula
l SetDataBuffer

When using api.Data.Calculate functions, it is important to know which Member a formula


is attached to. For example, if the formula starts with Api.Data.Calculate(“A#Sales1 = …”),
put the formula in the Sales1 account Member’s Formula setting.

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.

API Overview Guide 92


GetDataBuffer Functions

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.

For the basic GetDataBuffer, three properties are used:

l ScriptMethodType As DataApiScriptMethodType
l SourceDataBufferScript As String
l ExpressionDestinationInfo As ExpressionDestinationInfo

The scriptMethodType typically uses the Calculate option for DataApiScriptMethodType.

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.

2. Use GetDataBuffer in place of Api.Data.Calculate to use in Sub routines which


execute code and instructions, are stored in memory, and are used within
Functions throughout Finance Business Rules.

API Overview Guide 93


GetDataBuffer Functions

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:

API Overview Guide 94


GetDataBuffer Functions

API Overview Guide 95


Unbalanced Math Functions

Unbalanced Math Functions

Unbalanced Math Functions


Unbalanced math functions are required when performing math with two Data Buffers,
where the second Data Buffer needs to specify additional dimensionality. The term
Unbalanced is used because the script for the second Data Buffer can represent a
different set of Dimensions from the other Data Buffer in the api.Data.Calculate
text. These functions prevent data explosion. The four Unbalanced Math functions are:

l AddUnbalanced
l Example: api.Data.Calculate("A#TargetAccount = AddUnbalanced
(A#OperatingSales, A#DriverAccount:U2#Global, U2#Global)")
l SubtractUnbalanced

l Example: api.Data.Calculate("A#TargetAccount = SubtractUnbalanced


(A#OperatingSales, A#DriverAccount:U2#Global, U2#Global)")
l MultiplyUnbalanced
l Example: api.Data.Calculate("A#TargetAccount =MultiplyUnbalanced
(A#OperatingSales, A#DriverAccount:U2#Global, U2#Global)")
l DivideUnbalanced
l Example: api.Data.Calculate("A#TargetAccount =DivideUnbalanced
(A#OperatingSales, A#DriverAccount:U2#Global, U2#Global)")

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

API Overview Guide 96


Unbalanced Math Functions

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.

Unbalanced Math Functions Usage


Example using MultiplyUnbalanced in a working formula:

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.

When using GetDataBufferUsingFormula, FilterMembers and RemoveMembers are used


in conjunction to shrink down dimensional members in the source Data Buffer.

API Overview Guide 97


Unbalanced Math Functions

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:

Example using GetDataBufferUsingFormula with FilterMembers and MultipleUnbalanced


in a working formula:

API Overview Guide 98

You might also like