Finance Tunning Rule

edreyes
New Contributor II
Hi,
 
I have this loop that use multiply unbalance to get the UD3 member segmented in the accounts, this is the current rule but it's not delivering good performance:
 
edreyes_0-1690386223206.png

 

I try to recode the rule like this but is not calculating as the loop:
 
edreyes_1-1690386299650.png

 

Thanks for your time,
1 REPLY 1

RobbSalzmann
Valued Contributor

Move the BRApi call to get the list of MemberInfo outside of the loop.  It only needs to be called once.  You're calling it on every iteration of the loop which creates a ton of overhead:
Dim ud3MemberLst As List(Of MemberInfo) = BRApi.Finance.Metadata.GetMembersUsingFilter(si, "BU_Product", "U3#BU_Members.Base", True)For Each ud3Mem As MemberInfo In ud3MemberLst
....
Next

Also move the block of code below outside of the loop.  It only needs to run once, as its not using ud3Mem

RobbSalzmann_3-1690460351037.png

 

 If you really want to push the envelope, iterate your loop with parallel processing:

RobbSalzmann_2-1690460307727.png

In the future if you want specific code assistance, consider pasting your textual code into a code block instead of screenshots.  I can cut/paste pretty quickly, but I wont type it out for you.