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

YanSavinsky
New Contributor III

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

 

1 ACCEPTED SOLUTION

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.

View solution in original post

4 REPLIES 4

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
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.

Oscar
Contributor

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

DanielWillis
Contributor III

Hi Yan,

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

e.g.,

DanielWillis_2-1723763048060.png

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