Dashboard: XFBR String
Business rules written and used as Parameters that return a specific value based on the defined inputs. This Business Rule can be applied to any Dashboard or Cube View property where a Parameter is used. Imports System Imports System.Data Imports System.Data.Common Imports System.IO Imports System.Collections.Generic Imports System.Globalization Imports System.Linq Imports Microsoft.VisualBasic Imports System.Windows.Forms Imports OneStream.Shared.Common Imports OneStream.Shared.Wcf Imports OneStream.Shared.Engine Imports OneStream.Shared.Database Imports OneStream.Stage.Engine Imports OneStream.Stage.Database Imports OneStream.Finance.Engine Imports OneStream.Finance.Database Namespace OneStream.BusinessRule.DashboardStringFunction.XFBRStringExamples Public Class MainClass Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardStringFunctionArgs) As Object '------------------------------------------------------------------------------------------------------------ 'Reference Code: GetCalcStatus ' 'Usage: This shows different examples of BRString usage in Cube Views and Dashboards ' 'GetCalcStatus ' Parameter Example: ' BRString(XFBRStringExamples, GetCalcStatus, ParamCube = GolfStream, ' ParamEntity = [Houston Heights], ParamParent = Houston, ' ParamCons = USD, ParamScenario = Actual, ParamPeriod = 2011M1) ' 'GetUserIsAdmin ' Parameter Example: BRString(XFBRStringExamples, GetUserIsAdmin) ' 'EntityDesc ' Parameter Example: BRString(XFBRStringExamples, EntityDesc, ParamEntity=[|!MyEntity!|]) ' 'Created By: OneStream 'Date Created: 12-18-2017 '------------------------------------------------------------------------------------------------------------ Try Select Case args.FunctionName Case Is = "GetCalcStatus" 'Get the Passed in parameters Dim paramCubeValue As String = args.NameValuePairs("ParamCube") Dim paramEntityValue As String = args.NameValuePairs("ParamEntity") Dim paramParentValue As String = args.NameValuePairs("ParamParent") Dim paramConsValue As String = args.NameValuePairs("ParamCons") Dim paramScenarioValue As String = args.NameValuePairs("ParamScenario") Dim paramPeriodValue As String = args.NameValuePairs("ParamPeriod") Return BRApi.Finance.Data.GetCalcStatus(si, _ paramCubeValue, paramEntityValue, paramParentValue, _ paramConsValue, paramScenarioValue, paramPeriodValue) Case Is = "GetUserIsAdmin" 'Check to see if the user is an administrator ' (Can be used to hide objects that are administrator only) Return BRApi.Security.Authorization.IsUserInAdminGroup(si) Case Is = "EntityDesc" 'Get the Passed in parameter Dim myEntity As String = args.NameValuePairs("ParamEntity") Dim myEntityDesc As String = BRApi.Finance.Metadata.GetMember( _ si, 0, myEntity).Member.Description Return myEntityDesc End Select Return Nothing Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try End Function End Class End Namespace3.3KViews2likes0Comments