Skip to main content
September 16, 2022

How to setup transformation rule to look at parent text value in entity dimension?

  • September 16, 2022
  • 2 replies
  • 0 views

For Entity transformation rule, we want to build logic so that Source entity looks at its parent entity in one of our entity hierarchy in OS dimension, read and then map to the parent entity text8 assignment, then map to that entity the text8 assignment. How can we setup logic for that? 

2 replies

September 18, 2022

Hi,

I have used Complex expressions in the Data Source which should be able to do this, with something like:

 

If IWantParentText Then
Dim loadedEntity As Member = BRApi.Finance.Members.GetMember(si, dimType.entity, args.Value.toString)
Dim loadedEntityParent As list(Of Member) = BRApi.Finance.Members.GetParents(si, brapi.Finance.Dim.GetDimPk(si, "Entities"), loadedEntity.memberId, False)
' Return Text1
Return brapi.Finance.entity.Text(si, loadedEntityParent(0).memberId, 1)
Else
Return args.Value
End If

 

You can also put the complex expression in a mask Transformation rule.

DM me if you can't get it going and I'll see if I can help.

September 20, 2022

Thanks Mark. I modified the rule a bit and was able to use it. Thank you very much for the sample script.

 

Dim SourceEntity As String = Args.GetSource("E#")
Dim TargetEntity As String = ""

If SourceEntity.Length = 9 Then
TargetEntity = "HC" & SourceEntity.Substring(0,5)
Else
TargetEntity = SourceEntity
End If
If TargetEntity.StartsWith("HC17") Then
Dim loadedEntity As Member = BRApi.Finance.Members.GetMember(si, dimTypeID.Entity, BRApi.Finance.Members.GetMemberId(si,dimtypeID.Entity, TargetEntity))
Dim loadedEntityParent As list(Of Member) = BRApi.Finance.Members.GetParents(si, BRApi.Finance.Dim.GetDimPk(si, "JFS_Entities"), loadedEntity.memberId, False)
For Each mParent As Member In loadedEntityParent
If BRApi.Finance.Members.IsDescendant(si, BRApi.Finance.Dim.GetDimPk(si, "JFS_Entities"), BrApi.Finance.Members.GetMemberId(si,dimTypeID.Entity,"ActiveLifestyle"), mParent.MemberId) Then
Return BRApi.Finance.Entity.Text(si, mParent.MemberID, 8, -1, -1)
End If
Next
Else
Return TargetEntity
End If