Document sort

I have a document with two fileds. I need to sort the document on one of the field (fld2 in example). Please let me know how to do this. I am using webMethods 6.1. Also, I tried IDataUtil.sortIDataArrayByKey but not working. Looks like I am not creating proper input document and feeding to this java method.

eg:
Document
Fld1
Fld2

I appriciate your responce.

Thanks,
Brijesh

It is possible to develop a java service that does this. I know of at least one regular wMUsers contributer who has done so.

His approach involved building an IDataComparator class that implemented java.util.Comparator.

Mark

Yes as Mark said I would still go with writing Java service as sorting is a very time consuming and intensive process. I would rather use a quick sort algoritham java service and sort the document accordingly.

Brijesh,

I wanna make sure that I understand you correctly, cuz my answer will be subject to my understanding. When you say you have a document that you wanna sort, I believe you meant you wanna sort a documentList.

I have used IDataUtil.sortIDataArrayByKey and it worked just fine for me. In fact, I was on my way to create a Java service for that - using a quick sort (which I had earlier used to sort a string list), but then realized that I was reinventing the wheel. Writing a Java service of your own is obviously one way to go, but if your requirement is as simple as you have put in your post, I think the sortIDataArrayByKey should take care of it.

If you are sure that it isn’t working for you, post your sample data and I can try it out n let you know.

HTH, Rohit

See this post for a Java service that can sort a document list using a field within the document.
[url]wmusers.com