Makes query dynamic