Thank you for your article.

I have to admit that it's getting complex, but until today I used different SQL-Statements for each accumulation criterion and therefore only one criteria could be used at the same time.

Since I wanted to offer our users more possibilities it's necessary to have a dynamic statement.
IMO, the current statement is not too complex (furthermore I'm the only programmer in our team who is able to code RPGIV and SQL ).

In the meantime I've helped myself by arranging the "order by" criterias in a common way, which works in 99% of upcoming cases.

Thanks again and have good remainder of the day.

-- Tobias