Minimum and Maximum function in the expression editor

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.

Hi h_ak, thanks for the suggestion. Now min and max functions are launched. Please have a check.

Thanks for implement function!

The max and min functions reduced of function calls to perform a calculation by more than half, and also improved load of client.

1 Like