Skip to main content
November 25, 2024
Solved

UD8 Formula which checks if Base Member

  • November 25, 2024
  • 1 reply
  • 0 views

Hi!

New to Vb.Net here.

Trying to write a UD8 formula which extracts the right 3 characters of an Entity member name, only when the member is a base member.

Error message received says "'IsBase' is not a member of 'Member'." 

Anyone know how to make this work?

If api.View.IsAnnotationType() Then
'Check if the member is a base member
If api.Pov.Entity.IsBase Then
'Return the last three characters of the member name
    Dim membername As String =  api.Pov.Entity.Name
Dim lastThreeChars As String = Right(membername, 3)
Return lastThreeChars
Else
    'Return a NoData Datacell if not a base member
    Return api.Data.CreateDataCellObject(0.0,True, False)
End If
Else
    ' Return a NoData Datacell if not an annotation type
    Return api.Data.CreateDataCellObject(0.0, True, False)
End If

 

Best answer by Henning

Hi, most typically, one checks for base entities using this:

If Not Api.Entity.HasChildren() Then

 

Mostly, one wants to only execute a calculation on a base entity in local currency (= C#Local), so one would use this:

If (Not Api.Entity.HasChildren()) AndAlso Api.Cons.IsLocalCurrencyForEntity() Then

But the latter is mostly used for stored data to unnecessarily avoid recalculation of data where it already exists anyway through consolidation.

 

Adding this for the wider audience, one can also check is a member in a given dimension is a base member using Api.Members.IsBase(), e.g.:

Api.Members.IsBase(Api.Pov.EntityDim.DimPk, DimConstants.Root, Api.Pov.Entity.MemberId, Nothing)

 

 

1 reply

HenningAnswer
November 26, 2024

Hi, most typically, one checks for base entities using this:

If Not Api.Entity.HasChildren() Then

 

Mostly, one wants to only execute a calculation on a base entity in local currency (= C#Local), so one would use this:

If (Not Api.Entity.HasChildren()) AndAlso Api.Cons.IsLocalCurrencyForEntity() Then

But the latter is mostly used for stored data to unnecessarily avoid recalculation of data where it already exists anyway through consolidation.

 

Adding this for the wider audience, one can also check is a member in a given dimension is a base member using Api.Members.IsBase(), e.g.:

Api.Members.IsBase(Api.Pov.EntityDim.DimPk, DimConstants.Root, Api.Pov.Entity.MemberId, Nothing)

 

 

BWHITAKERAuthor
November 26, 2024

Thanks so much for the support!