Skip to main content
Newcomer
December 6, 2023

How to setup transformation rule to map if an item is a child member of a (another) dimension parent

  • December 6, 2023
  • 3 replies
  • 0 views

I am looking to create a transformation rule for Accounts to map to a destination if the Department on the record is a child of a specific parent in the OS department dimension.

ACCT600 DEPT101  --> ACT_EXP600_100
ACTT600 DEPT321  --> ACT_EXP600_100

Where departments 101 and 321 are descendants of Dept_TotRD

3 replies

OneStream Employee
December 7, 2023

If the number of such departments is low, the easiest approach is to have a number of Composite mappings that map A#yourAcc:U1#yourChildDept to a specific account. 

If that's not feasible, you will have to get dirty with a Complex Expression or Parser rule. You'll probably need args.GetSource or args.GetTarget to retrieve the UD member name, and BRApi.Finance.Members.IsChild (or .IsDescendant) to check if it's a child of your parent.

Newcomer
December 7, 2023

If you want to take the api route, I’d recommend you have your rule getting all children of that parent the first time the rule is executed and save results in a collection  (you can achieve this using globals and storing all children in hashset).

then you just have to check if member is contained in the hashset.

in this way you avoid multiple api calls (one for each line matching the rule criteria and not mapped yet)

HTH

kustrupAuthor
Newcomer
December 11, 2023

Thank you for the responses! I was able to resolve the issue with an IF statement:

If BRApi.Finance.Members.IsDescendant(si, _
    BRApi.Finance.Dim.GetDimPk(si, "DIMENSION_NAME"), _
    BRApi.Finance.Members.GetMemberId(si, dimTypeID.UD3, "PARENT_MEMBER"), _
    BRApi.Finance.Members.GetMemberId(si, dimTypeID.UD3, DEPARTMENT_FOR_DATA_RECORD)) _
Then

 

That being said, it is definitely more efficient to use a global variable as franciscoamores said.

Contributor
December 6, 2024

Was looking for something unrelated but your 'If Statement' inadvertently put me in the right direction.  Much appreciate you sharing your code.