Forum Discussion

KH1's avatar
KH1
Contributor II
4 days ago

Business Rule | One-to-One Transformation - E# Parent to its first E# Base

We need your help to Import flat files:
1. Number of Rows: > 100k
2. Organized under E# Parent Members: a few thousands
3. E# is extended

We've been fortunate to be advised to build a BR to generate a one-to-one Transformation Rule file.
- E# Parent to its first E# Base

Is it possible for you SMEs to be generous enough to share with us/Community:
- a sample BR to look up its first E# Base Member of an E# Parent Member
- under extended E#
- how to call that BR in an Import Workflow

Thank you, OS SMEs.

2 Replies

  • KH1's avatar
    KH1
    Contributor II

    BenEppel​,
    Thank you for generously sharing your expertise with us/Community.
    We're studying your suggestion to meet our requirements.
    We wish you continued success in your projects and career.

  • BenEppel's avatar
    BenEppel
    New Contributor III

    I believe something like this should work within a complex expression on a transformation rule (did not test). The dimension name logic may need some tinkering and I am not sure about the order of the base members being returned. If that's an issue you could tag the base member you want within a Text field and then include a where clause in the member filter so it will only return the member you want data loaded to. If no base members are returned it defaults to the source value. You might also need error handling if the source value isn't a valid member.

                Dim DimensionToken As String = "E#"
                Dim ParentMem As String = args.GetSource(DimensionToken)
                If String.IsNullOrEmpty(ParentMem) Then Return Nothing
    
                ' Hardcode or replace with your logic to determine the dimension name
                Dim DimensionName As String = "Entity"   ' <<< set appropriately
    
                ' Get base members under the parent (metadata order)
                Dim BaseMems As List(Of MemberInfo) =
                    BRApi.Finance.Metadata.GetMembersUsingFilter( _
                        si, DimensionName, DimensionToken & ParentMem & ".base", True)
    
                If BaseMems IsNot Nothing AndAlso BaseMems.Count > 0 Then
                    For Each mi As MemberInfo In BaseMems
                        If mi IsNot Nothing AndAlso mi.Member IsNot Nothing Then
                            ' Return the first base member name
                            Return mi.Member.Name
                        End If
                    Next
                End If
    
                ' If no base descendants, return the parent itself
                Return ParentMem