cast the quantity sort