I have the following code in a bind value on a form (see below),
the problem I have is some of the values can be zero (2-5) which results in an error due to it dividing by zero, I need to be able to check them and if they are zero run a different calculation to exclude them.
Could anyone please point me in the right direction.
Are you doing this client-side? If so, I would create a variable and store the result there. Then you can use a flow so you can include a condition on that variable.
If you’re doing this server-side then you use the Condition action.
I would tend to do all that kind of maths on the server side, either in your server action or using a database view. The client side really slows down fast if you try to do anything too complex.
You also have more logic available on the server side to check for zero values and decide what result you then want to return.