Ariba Supplier OnRamp 7.1 | webMethods Ariba Supplier OnRamp Documentation | webMethods Ariba Supplier OnRamp Installation and User’s Documentation | Development Utilities | Using the Attachment Utility | Working with the attachmentWrapperCollection Object | To Loop Through the attachmentWrapperCollection
 
To Loop Through the attachmentWrapperCollection
You can either loop through all the attachmentWrappers in a collection in either of the following ways:
*Use the pub.ariba.supplier.attachment.collection:getWrapperList service.
This service will return a list of attachmentWrapper objects. You can use the flow loop construct to loop through each element. This service is resource intensive. It should only be used for small number of attachments.
Set the sortOrder input parameter to forward to sort the list of attachmentWrappers first to last, or set it to backward to sort them last to first.
*Use the attachmentWrapperCollectionIteratorservice to iterate through the attachmentWrapper elements.
Using the iterator is much more efficient than using the getWrapperList. To use the collection iterator, invoke the service pub.ariba.supplier.attachment.collection.iterator:getIterator to get an iterator object for the collection.
Set the direction input parameter to forward to iterate through the list of attachmentWrappers first to last, or set it to reverse to sort them last to first.
Once you have the collectionIterator object, use the getIterator and iteratorHasMoreWrappers services in a repeat flow statement as follows.
INVOKE pub.ariba.supplier.attachment.collection.iterator:getIterator
REPEAT (repeat-on SUCCESS)
INVOKE
pub.ariba.supplier.attachment.collection.iterator:iteratorHasMoreWrappers
BRANCH on hasMoreWrappers
SEQUENCE true
INVOKE
pub.ariba.supplier.attachment.collection.iterator:getNextWrapperFromIterator
<do something with the attachment wrapper>
SEQUENCE false
EXIT $loop