Forum Discussion
- kustrupNew Contributor
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.
- WernerNContributor
Was looking for something unrelated but your 'If Statement' inadvertently put me in the right direction. Much appreciate you sharing your code.
- franciscoamoresContributor II
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
- JackLacavaHonored Contributor
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.
Related Content
- 12 months ago
- 12 months ago
- 11 months ago