Iterating in a tamino query result

Hello again:

I’m trying to iterate in a tamino query response, that must return two elements. If I use the “stream” accessor, both documents appear, but with the “XML” accessor, only the first document appears in the payload.

All is OK by now, but… the “xbd.tamino.iterator” property doesn’t exist (documentation ensures that it must be created by the SagTaminoQuery component) . It seems like only one document is retrieved.

  1. Must the “xbd.tamino.iterator” property exist?
  2. How can I iterate in a while loop…
    a) …using the “XML” accessor?
    b) …using the “stream” accessor?

Thanks very much.

To answer your questions…

Should the xbd.tamino.iterator property exist?

Ans: Yes, but you will not be able to access it or its value. The iterator property can be tested in a sequence using “if” or “while”. Additionally, the only test that can be made on it are “exists” and “notexists”.

How can I itereate in a while loop?

In the case of an XML accessor, the query component only returns one document at a time. Because of this, you have to place a copy of the original query step inside of a while. The while loop should test for the existence of the xbd.tamino.iterator property. Once the last document retrieved by the query has been passed to the mediator it should be deleted which will end the loop.

In the case of the Stream accessor, you revieve the complete results of the query in one document. If you have the requirement to process each query result seperately you could use xpath to count() the nodes and set that value to a property. You them initiate a while loop to iterate through the result documents using Xpath to move from one to the next node.

I hope that helps :smiley: