Index: trunk/DataCheck/Sourcefile.sh
===================================================================
--- trunk/DataCheck/Sourcefile.sh	(revision 14825)
+++ trunk/DataCheck/Sourcefile.sh	(revision 14826)
@@ -212,4 +212,5 @@
    prims=( `getfromsetup $step "Primaries"` )
    maintable=`getfromsetup $step "MainTable" | sed -e "s/\ //g"`
+   sort=`getfromsetup $step "SortDirection" | sed -e "s/\ //g"`
 #   echo " maintable: "$maintable
 #   echo " needs: "${needs[@]}
@@ -294,5 +295,11 @@
    getstatusquery $2
    # order by priority to the the number of the next step to be done
-   query=$query" ORDER BY "$step"Status.fPriority desc "
+   query=$query" ORDER BY "$step"Status.fPriority "
+   if [ "$sort" = "" ]
+   then 
+      query=$query" DESC "
+   else
+      query=$query" "$sort
+   fi
    # add limitation in case only one or a limited number of 
    #  processes should be executed
