How to pass standard formatting conditionals to an XFBR rule?
- 4 years ago
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