Search code examples
javasortingdocumentwebmethods

pub.document.sortDocuments not sorting


I am stuck, I had this working last week now I have changed something and it will not work!

I have a simple flow service as follows:

pub.file.getFile 
pub.flatFile.convertToValues 
pub.document.sortDocuments

But the sortDocuments stage is not doing anything. The recordWithNoID document list is perfect and all the fields are correct (so the schema and dictionary are working as intended), but when I try to sort it on the key "Field1" the sort is not doing anything, the documents are not changing order at all.

See two attached screenshots: Screenshot 1 shows the pipeline during pub.document.sortDocuments step key variable is: Field1 order variable is:ascending

Screenshot 2 shows the recordwithNoID after running the flow service. As you can see the Field1 column has not been ordered correctly.(it's still in the original document order) I have also tried mapping the results to other document types with the same result.

As I said above I had this working last week and now cannot seem to get it to work. I have even started the whole process from scratch and it still will not work. Any help would be very much appreciated!

Screenshot1

Screenshot 2

EDIT: I resolved this issue by mapping to the Document Type created from the Schema.


Solution

  • It appears that you map the ffValues document (IData) and not the recordWithNoID document list (IData array) inside it, which would be the wrong level.

    Please map the recordWithNoID instead and let us know if that solves the issue.

    While not related to the question, it seems that some "clutter" is on the pipeline. I always recommend to people that they drop variable as early as possible. Mostly to improve readability but also for performance.