how to dynamically add values to a Document List

Hi

I am using flow-service to solve the below problem.

The situation is:
I have a document and a document list. When I make a call to a web-service, I get back the output as a document. The document has a field which determines if the web-service needs to be called again or not. Depending on how many web-service calls I have to make, I will have those number of documents which I have to store it in document List.

If I use the construct: loop, I have to specify input array and output array. I have the output array ie the document list. But I dont have the input array because it is the single document and will immediately break.

If I use the construct: repeat, the document overrites the first element of the document List. So I never get the entire array, it is only the last document that gets assigned to the document list.

In order to continue using loop, I will need an array which I can assign to input array. But I have to keep adding element to the array inside the loop which would make the loop continue as long as I want to. In the flow-service if I try to assign values/elements to array, it overrites previous values. Can someone please tell me how to do that.

Even If someone can tell me how to achieve ‘do-while’ looping or ‘continue’ (standard features available in java) in flow-service, I should be able to solve my problem.

Please let me know if anymore information is required.

Thanks a lot

repeat on success
… call web service
… appendToDocumentList
… branch on document.variable
… $default : exit from loop
… call again: do nothing

This approach will be good for a few hundred append calls. More than that will bog down the IS.

You might put in a check to protect against infinite loops. e.g. stop after $iteration goes above 10, 100, 1000, whatever.

Thanks a lot. Appreciated…

I am new to webmethds…

What is appendToDocumentList?

Thanks

Its a built-in Service. Yoo can find it as WmPublic.pub.list:appendToDocumentList()

Regards,
Sudarshan

Thanks :slight_smile: