Filling with liquid

I have created flat cylinder with water mesh and I adjust the scale based on height (in this case I needed 3 ifs).