The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
Alvaro
1 year agoNew Contributor III
Display Text1 member property instead of name or description in cubeview
My client has member property Text1 in UD1 as a second description or alias, he wants to display Text1 instead of name or description. I tried with CV Function "u1#top.descendants.where(Text1 <> '')"...
- 1 year ago
You can use an XFBR rule. See script below. The member filter in the CV would be:
u1#top.descendants.where(Text1 <> ''"):Name(XFBR(XFBR_Example, GetTextFieldForDescription, UD1Member = |MFUD1|))
XFBR Rule:
Imports System Imports System.Collections.Generic Imports System.Data Imports System.Data.Common Imports System.Globalization Imports System.IO Imports System.Linq Imports Microsoft.VisualBasic Imports OneStream.Finance.Database Imports OneStream.Finance.Engine Imports OneStream.Shared.Common Imports OneStream.Shared.Database Imports OneStream.Shared.Engine Imports OneStream.Shared.Wcf Imports OneStream.Stage.Database Imports OneStream.Stage.Engine Namespace OneStream.BusinessRule.DashboardStringFunction.XFBR_Example Public Class MainClass Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardStringFunctionArgs) As Object Try If args.FunctionName.XFEqualsIgnoreCase("GetTextFieldForDescription") Then Dim ud1Member As String = args.NameValuePairs.XFGetValue("UD1Member","None") Dim ud1MemberID As Integer = BRApi.Finance.Members.GetMemberId(si, dimTypeId.UD1, ud1Member) Dim ud1TextField As String = BRApi.Finance.UD.Text(si, dimTypeId.UD1, ud1MemberID, 1,Nothing,Nothing) Return ud1TextField End If Return Nothing Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try End Function End Class End Namespace
TheJonG
OneStream Employee
1 year agoYou can use an XFBR rule. See script below. The member filter in the CV would be:
u1#top.descendants.where(Text1 <> ''"):Name(XFBR(XFBR_Example, GetTextFieldForDescription, UD1Member = |MFUD1|))
XFBR Rule:
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Data.Common
Imports System.Globalization
Imports System.IO
Imports System.Linq
Imports Microsoft.VisualBasic
Imports OneStream.Finance.Database
Imports OneStream.Finance.Engine
Imports OneStream.Shared.Common
Imports OneStream.Shared.Database
Imports OneStream.Shared.Engine
Imports OneStream.Shared.Wcf
Imports OneStream.Stage.Database
Imports OneStream.Stage.Engine
Namespace OneStream.BusinessRule.DashboardStringFunction.XFBR_Example
Public Class MainClass
Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardStringFunctionArgs) As Object
Try
If args.FunctionName.XFEqualsIgnoreCase("GetTextFieldForDescription") Then
Dim ud1Member As String = args.NameValuePairs.XFGetValue("UD1Member","None")
Dim ud1MemberID As Integer = BRApi.Finance.Members.GetMemberId(si, dimTypeId.UD1, ud1Member)
Dim ud1TextField As String = BRApi.Finance.UD.Text(si, dimTypeId.UD1, ud1MemberID, 1,Nothing,Nothing)
Return ud1TextField
End If
Return Nothing
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Function
End Class
End Namespace
Alvaro
1 year agoNew Contributor III
Thank you, it is very useful and it is what I wanted. However, my client has more than one Text1 with the same value (repeated), then he need a sum of these cellamounts in one and displaying only the Text1 no repeated.
- TheJonG1 year ago
OneStream Employee
For that requirement, you would need to set up an attribute dimension that refers to the text field.
- Alvaro1 year agoNew Contributor III
Hi TheJonG, I am trying this XFBR BR, but I don't get results:
If args.FunctionName.XFEqualsIgnoreCase("GetTextFieldForDescription2") Then
Dim ud1Members As List(Of String) = args.NameValuePairs.XFGetValue("UD1Members", "").Split(",").ToList()
Dim groupedValues As New Dictionary(Of String, Double)For Each ud1Member In ud1Members
Dim ud1MemberID As Integer = BRApi.Finance.Members.GetMemberId(si, dimTypeId.UD1, ud1Member)
Dim ud1TextField As String = BRApi.Finance.UD.Text(si, dimTypeId.UD1, ud1MemberID, 1, Nothing, Nothing)
Dim value As DoubleIf Double.TryParse(ud1TextField, value) Then
If groupedValues.ContainsKey(ud1TextField) Then
groupedValues(ud1TextField) += value
Else
groupedValues.Add(ud1TextField, value)
End If
End If
Next' Actualizar los valores en la base de datos
For Each kvp In groupedValues
BRApi.Finance.UD.Text(si, dimTypeId.UD1, BRApi.Finance.Members.GetMemberId(si, dimTypeId.UD1, kvp.Key), 1, kvp.Value.ToString(), Nothing)
NextReturn groupedValues
End IfDo you know what could be happening?
Thanks a lot.
- TheJonG1 year ago
OneStream Employee
What exactly are you trying to do and where are you call the rule? I can see right away that the return statement is returning the groupedValues variable which is a Dictionary. Only Strings can be returned in XFBR rules.
Related Content
- 2 years ago
- 2 years ago
- 9 months ago