How to pass standard formatting conditionals to an XFBR rule?
Hello:
Looking for guidance on how to implement an enhanced conditional formatting check. It's quite simple, apply some formatting based on the account type.
Consider the example of a single row CubeView with one account as the member filter: A#A87999. Formatting should be applied if the account is a Liability type.
I have a mostly working XFBR helper that can correctly apply formatting but only if I hardcode in the account reference. Obviously that won't work for all but the simplest CV as reports are often dynamic with Member Expansions.
The mainly working formatting syntax as currently written:
If (XFBR(XFBR_FormattingHelper, AccountTypeIsLiability, Account=[A8799])=True) Then
TextColor = Red
End If
How do I make the parameter dynamic? I've tried the following:
... Account=RowE1MemberName
... Account=|RowE1MemberName|
... Account=[RowE1MemberName]
... Account=[|RowE1MemberName|]
None seem to work. Is there a different way to reference the standard available conditionals?
Thanks,
Dave
Thanks Eric, using the In syntax is a working solution, albeit a brute force one. I would love to understand more how you arrived at the conclusion that |MF| substitutions won't work here. This is the type of info I am hoping to see in the documentation. Else we're just throwing ideas against the wall until something sticks.
Final conditional string:
If (RowE1MemberName In XFBR(XFBR_FormattingHelper, InAccountTypeIsLiability, Account=[AccountHierarchy])) Then
TextColor = Red
End IfFinal XFBR:
If args.FunctionName.XFEqualsIgnoreCase("InAccountTypeIsLiability") Then
Dim accountName As String = args.NameValuePairs.XFGetValue("Account")
Dim accountId As Integer = BRapi.Finance.Members.GetMemberId(si,DimType.Account.Id,accountName)
Dim accountDescendantsAreLiability As List(Of Member) = BRapi.Finance.Members.GetDescendants(si,BRapi.Finance.Dim.GetDimPk(si,"AllAccounts"),accountId).Where(Function(x) BRApi.Finance.Account.GetAccountType(si, x.MemberId).ToString = "Liability").ToList()
Dim strLiabilityAccounts As String = String.Join(",",accountDescendantsAreLiability.Select(Function(x) x.Name))
Return strLiabilityAccounts
End IfCouple of items if others stumble upon this thread:
The conditional In statements expects a comma separated literal string. Not a List(Of String), and not a string delimited by anything else.
This is still less than ideal as you are returning a large majority of the hierarchy for each and every member this is evaluated against and you must still update the XFBR string if you have multiple hierarchies in play.
I'll file a bug/enhancement request for the issues and inconsistencies noted.
Thanks,
Dave