get_next_ordering util.