Forum Discussion

edreyes's avatar
edreyes
New Contributor II
2 years ago

Finance Tunning Rule

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:
 

 

I try to recode the rule like this but is not calculating as the loop:
 

 

Thanks for your time,
  • RobbSalzmann's avatar
    RobbSalzmann
    Valued Contributor II

    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

     

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

    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.