Forum Discussion

YanSavinsky's avatar
YanSavinsky
New Contributor III
5 months ago

How to derive Member ID from a Member Name in a Business Rule?

I am developing a member formula which uses Percent Of Ownership in calculation.

I am using the following to get Percent of Ownership:

Dim pOwn As Decimal = api.Entity.PercentOwnership(entityID, parentID)

In the context of this calculation I have parentID but I only have a name for the entity. How can I get the Member ID from the Member Name?

Additional question: what will the code above return if there is NO parent/child relationship between parentID and entityID? "0"?

Thanks in advance.

Yan

 

  • Dim ForEntityID As Integer = BRApi.Finance.Members.GetMemberId(si, DimType.Entity.Id, ForEntity)

    You will need to put the Entity name in the variable ForEntity.

  • MarcusH's avatar
    MarcusH
    Contributor III
    Dim ForEntityID As Integer = BRApi.Finance.Members.GetMemberId(si, DimType.Entity.Id, ForEntity)

    You will need to put the Entity name in the variable ForEntity.

  • Sweez's avatar
    Sweez
    New Contributor III

    To get the memberId for your entityID use the following:

    Dim memberID As Integer = BRApi.Finance.Members.GetMemberId(si, dimTypeId.Entity, memberName)

    As for your last question I am not sure.  My suggestion would be to just do some testing with different entityids and print the result.

  • Dim CoID As Integer = api.Members.GetMemberId(dimtype.Entity.Id,"CompanyName")

  • DanielWillis's avatar
    DanielWillis
    Valued Contributor

    Hi Yan,

    For future reference, you actually could have found this out quite quickly yourself through the snippets.

    e.g.,

    In regards to the other question, I vaguely remember that function actually returning 100 if there was no relationship but don't quote me on that.

    Regards,

    Daniel