Hi, Yeeflow.
I want to find the maximum and minimum values in the expression editor.
The iif function can be used to find the maximum and minimum values.
However, the expression corresponding to max(A, B)
is iif(A > B, A, B)
, which means writing A and B twice.
The clamp function defined in the programming language can be reproduced as follows
clamp(X, MIN, MAX)
= max(MIN, min(MAX, X))
= iif(MIN > X, MIN, iif(MAX < X, MAX, X))
Assuming that X is the result of some calculation, describing it multiple times would use extra computational resources and storage space (e.g., using a separate calculate field to concisely describe X).
Therefore, it would be useful to have min, max, and clamp functions available.