Hatim_Elhaouma
6 days agoNew Contributor II
Vary description vy user culture in XFBR
Hello,
We are facing the following issue, we use the following xfbr to generate accounts in a cubeview rows and retrieve descriptions : XFBR(CCF_XFBR, GetCCFDrillDownWithDescription2,memberExp=[A#CashFlow_Gestion.TreeDescendantsInclusive], Time=|CVTime|).
However, the Cube View where this XFBR is applied always displays the descriptions in the default format. The description does not adapt based on the user’s culture settings.
How can we make the XFBR return descriptions that vary according to the user culture?
For reference, here is the XFBR code :
Public Function GetCCFDrillDownWithDescription2(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardStringFunctionArgs) As String
Try
'Get the Dim PK for Entity Dimension
Dim accountDimPk As DimPk = BRApi.Finance.Dim.GetDimPk(si,args.SubstVarSourceInfo.WFAccountDim)
Dim flowDimPk As DimPk = BRApi.Finance.Dim.GetDimPk(si,args.SubstVarSourceInfo.WFFlowDim)
'Dim memberListClass As New OneStream.BusinessRule.Finance.CCF_FinanceLogics.MainClass
Dim memFilterAccounts As List(Of MemberInfo) = BRAPi.Finance.Members.GetMembersUsingFilter(si, accountDimPk, args.NameValuePairs("memberExp"), True)
If memFilterAccounts.Count = 0 Then
' brapi.ErrorLog.LogMessage(si,"Cash flow Account Member Not found in CubeView member filter. Check XFBR syntax (GetCCFDrillDown) in Cube view")
Return "A#None:F#None:Name(Please check memberfilter in cubeview. Cashflow Account not found)"
End If
'Use a text builder to build a string
Dim resultString As New Text.Stringbuilder()
Dim isfirstItem As Boolean = True
' Dim accountFlowComb As String
' Dim flowBaseMembers As List(Of Member)
Dim objDataCellInfoUsingMemberScript As New DataCellInfoUsingMemberScript
Dim tftEntityID As Integer = Brapi.Finance.Members.GetMemberId(si,dimTypeId.Entity, "CF")
Dim objScenarioType As ScenarioType = BRApi.Finance.Scenario.GetScenarioType(si, args.SubstVarSourceInfo.WFScenario.MemberId)
Dim timeReference As String = BRApi.Finance.Entity.Text(si, tftEntityID, 1, objScenarioType.Id, args.SubstVarSourceInfo.WFTime.MemberId)
Dim MatrixTime As String = args.NameValuePairs("Time")
Dim scenarioReference As String = BRApi.Finance.Entity.Text(si, tftEntityID, 2, objScenarioType.Id, args.SubstVarSourceInfo.WFTime.MemberId)
If scenarioReference = String.Empty Then scenarioReference = args.SubstVarSourceInfo.WFScenario.Name
Dim cashFlowSettings As DataTable = BRApi.Import.Data.FdxExecuteDataUnit(si, "PARAM_CF", "E#CF", "Local", objScenarioType.Id,"S#" & scenarioReference, "T#" & MatrixTime, "YTD", True, "Amount <> 0", 4, False)
'Dim cashFlowAdj As DataTable = BRApi.Import.Data.FdxExecuteDataUnit(si, "CONSO", "E#CF", "Local", objScenarioType.Id,"S#REEL","T#" & timeReference , "YTD", True, "Amount <> 0", 4, False)
'Exit Function
Dim CFSiN As Boolean = cashFlowSettings Is Nothing
If cashFlowSettings Is Nothing Then
Brapi.ErrorLog.LogMessage(si,"No CashFlow setting found")
Return ""
'Exit Function
ElseIf cashFlowSettings.Rows.Count = 0 Then
Brapi.ErrorLog.LogMessage(si,"No CashFlow setting found")
Return ""
'Exit Function
End If
Dim space As String = String.Empty
Dim sign As String = String.Empty
Dim AccountDescription As String
' Dim AccountDescription2 As String
For Each account As MemberInfo In memFilterAccounts
' brapi.ErrorLog.LogMessage(si,"account " & account.NameAndDescription)
space = " "
For i = 0 To account.IndentLevel
space = space & " "
Next
'Exit Function
resultString.Append("A#" & account.Member.Name & ":Name(" & space & account.Member.NameAndDescription & "):F#None,")
'resultString.Append("A#" & account.Member.Name & ":Name(" & space & account.Member.NameAndDescription & "):F#None:U7#MT_RETTFT,")
' Cb#CONSO:E#EIMER:P#?:C#Local:S#REEL:T#2022M12:V#YTD:A#RD_T110:F#None:O#Top:I#Top:U1#None:U2#None:U3#Top:U4#None:U5#None:U6#None:U7#MT_RETTFT:U8#CF_CalcAmount
'Ajout des ecritures
Dim memberFilter As String = "MT_RETTFT"
Dim UD7Desc As String = BRApi.Finance.Metadata.GetMember(si, dimTypeId.UD7,memberFilter).Description
'ResultString.Append("A#" & account.Member.Name & ":Name(" & space & account.Member.NameAndDescription & "):F#None:U7#MT_RETTFT:Name(" & UD7Desc & "),")
If Not BRApi.Finance.Members.HasChildren(si, accountDimPk, account.Member.MemberId) Then
Dim cashFlowSettingRows() As DataRow = cashFlowSettings.Select("UD7 = '" & account.Member.Name & "' AND UD8 = 'None'")
For Each row As DataRow In cashFlowSettingRows
AccountDescription = BRApi.Finance.Metadata.GetMember(si, dimTypeId.Account,row("Account")).NameAndDescription
If row("Amount") = -1 Then sign = "(-)"
'ResultString.Append("A#" & row("Account") & ":Name( "& space & " " & AccountDescription & "):F#" & row("Flow") & ":U7#" & account.Member.Name &",")
'ResultString.Append("A#" & row("Account") & ":Name( "& space & " " & AccountDescription & "):F#" & row("Flow") & ":U7#" & row("UD7") &",")
ResultString.Append("A#" & row("Account") & ":Name( "& sign & space & AccountDescription & "):F#" & row("Flow") & ":U7#" & row("UD7") &",")
Next
ResultString.Append("A#" & account.Member.Name & ":Name( " & space & account.Member.Name & space & UD7Desc & "):F#None:U7#MT_RETTFT:U8#None" &",")
'ResultString.Append("A#" & account.Member.Name & ":Name(" & space & account.Member.NameAndDescription & "):F#None:U7#MT_RETTFT:Name(" & UD7Desc & "),")
End If
Next
Return resultString.ToString
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Function