'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 1:[1]

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.

Solution 2:[2]

I am not sure but maybe this is the problem: on screenshoot1 we can see that you sort ffValues but you are mapping it to the document. (because you are using invoke, it is done automatically) Is screen number two is showing ffValues or document variable ? Maybe you are checking wrong, not sorted variable?

I am also want to suggest to use Map and transformer rather than invoke, because using map gives you power to control the pipeline. While using invoke each variable is save to the pipeline (having varaible with the same name on pipeline ale on the output of the service will result with overwrite on pipeline variable).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Christoph Jahn
Solution 2 MDaniluk