Pb with reference in document list

Hello, I work on WM6.

I developed a service that is finding data in a database. The result of this service is a document list with string fields containing the data. This service is also paginated : it returns no more than 20 results at a time and the number of pages.

I have to invoke that service in order to retrieve all the data (all the pages). To do that I make a repeat and I exit only if the current page number equals the total page number. All that works fine except the data mapping.

In fact, in order to construct the final document list, I use pub.list:appendToDocumentList, but what’s happening is that every call of the service in the repeat step updates the data in the first elements of the final document list. That’s because appendToDocumentList doesn’t create a new list but makes only a reference. I tried to use a temporary list and I use pub.flow:clearPipeline to drop the result values of the service while appended. I’m not able to make it work as I would like.

Can somebody who knows well working with lists can help me ?


Hi everybody,

I solved my problem. I describe what I’v done as I’m sure it will help somebody :

In order to construct my document list correctly, I had to call twice pub.list:appendToDocumentList. First time I take my results and I append it to a temporary list, dropping the results. Then I append the temporary list to my final list, dropping the temporary list. There are no more reference problems and I can see all the results that I wanted in my final document list.