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.
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.
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.
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.
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
Initialize the 3 helper documents as empty list before the loop
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.
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.
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.