"For Each" type of Functionality in Corticon 5.7.2

Posted by Anverion on 15-Mar-2019 05:31

Hello--

Yes, it's me again :) I have a task and I'm not too sure of how to approach this. I have earnings details that I pull into my workflow. They would look something like this:

Details

efd id     detail id    amount

1            1              100

1            2              50

1            3             75

And payments:

payment id       payment seq        amount

1                       1                          200

1                       2                          10

1                       3                          15

What I need to do is for each payment, iterate through the details and assign a percentage of the payment based on the sum of the details for each efd id (payment seq amount / sum(detail amount)). The order must be ascending for the payments and the same applies for the details.

The payments can be 1 or 100 so iteration needs to be dynamic.

I know there are a few iteration tools available, however, in my experience (or lack thereof) it's hot or miss, and I end up reaching a max loop count violation for even a small number of details/payments.

Any help would be appreciated.

Thanks in advanced.

-Branden

All Replies

Posted by Harold-Jan Verlee on 15-Mar-2019 10:06

Hey Branden,

I'm trying to get my head around what you are trying to accomplish. Please understand that Corticon iterates automatically over collections, so no need to introduce programmatic iteration constructs in your rules. What needs to be clarified is how you calculate the percentage of earnings for each payment and why sequence (order) would matter. I have created a little example (see attached), but it may not reflect what you want. A calculation example would help to illustrate your challenge. Thanks! Harold

[View:/cfs-file/__key/communityserver-discussions-components-files/14/earnings.zip:320:240]

This thread is closed