InsertAndUpdateLoopNode doesnt work with RecordsPerIteration

This forum allows users to post and respond to "How Do I Do ....." questions. The information contained in this forum has not been validated by K-Rise Systems and, as such, K-Rise Systems cannot guarantee the accuracy of the information.
Post Reply
CathyC
Posts: 469
Joined: November 16th, 2021, 11:15 am
Contact:

InsertAndUpdateLoopNode doesnt work with RecordsPerIteration

Unread post by CathyC »

If you have a loop which has a RecordsPerIteration not set to 1, InsertAndUpdateLoopNode service does not work as expected.
  • It only updates the very first loop node.
    So if you send 1-5, nodes 2-5 are not updated.
  • On top of that, looping on nodes 6-10 (loop #2) actually modifies node 2 instead.
    Nodes 11-15 (loop #3) modifies node 3, 16-20 (loop #4) modifies 4, and so on...
  • There also seems to be a bug if number of total nodes being looped on is not divisible by RecordsPerIteration.
    If there are 50 total nodes:
    Valid: 1, 2, 5, 10
    Invalid: 3, 4, 6, 7, 8, 9
  • For the invalid ones, the final iteration uses the wrong name for the path of the parent.
    For example, if _LoopNode/WorkData/DatesList/Output/Result/Date is the correct path, then the final iteration somehow creates it as _LoopNode/WorkData/Date/Output/Date
    DatesList was renamed and Result is missing entirely.
Why use it?
Loops are mainly meant for looping on one record at a time. This makes sense when we're looping one at a time over a total of like 30 records.

But when we created loops, we recognized that during batch jobs, when working with large amounts of records, doing one at a time might be too inefficient and our already built batch jobs are doing things for like 10 or 50 at a time. Then the logic in the loop would be built to handle multiple at a time.

We knew this was an advanced case, but one that our developers run into for EC that see a lot of addresses/items. At the time it was introduced our complex batch jobs were already built, but we said if we wanted to do them again without having to create our own loops, this would have helped.
word count: 311

Tags:
JefferyD
Posts: 177
Joined: August 31st, 2021, 11:37 am
Contact:

Re: InsertAndUpdateLoopNode doesnt work with RecordsPerIteration

Unread post by JefferyD »

For added context, I set up a Loop service with the following:
Node: WorkData/DatesList/Output/Result/Date
RecordsPerIteration: 7
image.png

If the number of nodes is not divisible by RecordsPerIteration (7), then the loop node fails to load correctly for the last iteration.
image.png
Node path: [_LoopNode/WorkData/DatesList/Output/Result/Date]

image.png
Node path: [_LoopNode/WorkData/Date/Output/Date]


When RecordsPerIteration does work, InsertAndUpdateLoopNode seems to incorrectly match the "Record" index with the "Iteration" index. So node#3 is included in the 1st iteration, but is updated by the 1st record of the 3rd iteration:
image.png
word count: 94
Post Reply