How to get back into loop after exiting?

I have a loop. While looping, I exit the loop, whenever I see a new value for a particular field. This helps me to write a separate output with a specific value. But the problem is I do not know how to get back in to the loop (where I left) after writing each output. Any feedback will be appreciated.

Thanks
SivaK

Can you post a sample scenario here with input and expected output documents. Hopefully the should be a way out without going for a custom Java service.

Hi SivaK ,

Why are you existing the loop when you need to enter the loop again :roll: . Make use of some flag/indicator variable :idea: .

Mahesh,

Amit_8 is my input file. AT, AV, and AW are the values of the field that I use for producing separate outputs. Since I can attach only 3 files, I am attaching my code snippet with the next post. In the branch step where I compare current wh to saved wh (AT, AV, and AW are the wh values). if I put EXIT step (exiting loop), it will write only the first warehouse (AT). If I just branch without exiting, it will write blank file for AT, and AV and output the entire contents under AW.

Thanks
POAAWMS104_AW.txt (1.85 KB)
POAAWMS104_AT.txt (741 Bytes)
Amit_8.xml (5.2 KB)

Mahesh,

Here is my code snippet.

code_snipet.docx (188 KB)

Hi Siva,

can you provide the properties for the Exit-Step please?

Additionally the code snippet looks a bit weird as the Steps after the exit step will not be executed.

An option might be to prepare the output in some helper documents and transfer them after the loop has completed.

Regards,
Holger

Thanks Holger.

The only property on the EXIT step is “signal - SUCCESS”. all other properties are blank.

Yes the steps following EXIT will not be executed. That is the scenario when only output for AT is produced and outputs for AV and AW are not produced. If I disable the EXIT step, the outputs for AT and AV are blank and the output for AW contains all the values of AT, AV, And AW.

The idea about helper documents sound interesting. But I don’t know anything about helper documents. What are they and where I can learn learn more about them.

Thanks
Siva

Hi Siva,

helper documents will be just a reference to one of your existing doctypes.
As per your description you will need 3 of them:
helper_AT, helper_AV, helper_AW

  1. Initialize the 3 helper documents as empty list before the loop
  2. Inside the loop place a branch on field WH_ID to split the incoming list between the warehouses and add the current document to the right outgoing list using built-in service.
  3. After the loop is finished you can then write the 3 helper documents to the correct filenames.

I hope that I have understood your requirement correctly.

Regards,
Holger

Hi Siva,

additional information:
When specifying an Output Array on a Loop Step, the Output Array has the same length as the Input Array,

When using the approach with the helper documents I have described in my previous post please remove the Output Array from the Loop Step as the resulting lists will be shorter than the Input Array.

Regards,
Holger