Forum Discussion

MatthieuR's avatar
MatthieuR
New Contributor III
2 years ago

Assess in a rule if entity member is a parent

Hello All,

We have a requirement to make some text display dynamically showing or not based on whether the entity member selected in a combo box is a base member or a parent.

In my XFBR, I found this function that would give me this information but when I set it up, it returns me false, whereas in some cases, the entity selected had children (so is a parent).

"Dim IsParent As Boolean = BRApi.Finance.Entity.HasChildren(si, EntitydimPk, SelectedEntityID, Nothing)"

Could you let me know where my function's set up could be wrong or also if you would propose to use an other solution to achieve this requirement ?

Thank you

  • Henning's avatar
    Henning
    Valued Contributor II

    Hi Matthieu,

    no time to test at the moment, but hopefully you find this useful. Did you write the entityId into your error log to confirm that the XFBR picks up the correct entity? It often happens that the loop is incorrectly picked up and it looks like the function does not work even though something before that may have gone wrong.

    You could also have a go with those two functions to see whether that makes a difference:

    brapi.Finance.Members.IsBase(si, dimPk, ancestorMemberId, baseMemberId, Nothing)
    brapi.Finance.Members.HasChildren(si, dimPk, memberId, Nothing)

  • JackLacava's avatar
    JackLacava
    Honored Contributor

    That API call is quite fundamental and used in millions of calculation rules everywhere, so I'd expect it's it's pretty reliable (or all alarms would be going off at "Support HQ"...). I would do what Henning suggested and make sure that the parameters fed to it are actually correct, with a good ol' Brapi.ErrorLog.LogMessage.