How to choose maximum values calculated automatically from app