I’ve been having a look around the forum and can’t really find an answer to my problem and I was wondering whether anyone might have done this before in wappler and would mind giving some advice on it.
I need to multiply some values in a form (this bit i can do)
The problem is that there’s a number of levels I need to calculate
In example - When the value is between 0-50 It needs to calculate by a specific amount, if the value is between 51-100 it needs to be calculated by different amount, etc.
Before using Wappler i would have just posted the form to a processing page and calculate it with php then push that into a confirmation form after its calculated. I just wasn’t sure whether there was a better way to do it in wappler.
Well such a condition requires a little more complex calculations like:
If you use this as an input value, use this: dmx-bind:value="input1.value * ((input1.value.toNumber() <= 30) ? 50 : ((input1.value.toNumber() > 30 && input1.value.toNumber() <= 50) ? 25 : 1))"
If you use this as a binding on the page use this: {{input1.value * ((input1.value.toNumber() <= 30) ? 50 : ((input1.value.toNumber() > 30 && input1.value.toNumber() <= 50) ? 25 : 1))}}"
Where input1 is the id of the input which you check, so replace it.
Also there is a third condition, everything which is not < 30 or <50 - not sure how do you want to handle this, but just replace the last “1” with the number any value greater than 50 must be multiplied.
I would love this. I have to do the same that was mentioned earlier, I offload the calculations to a server-side page for processing. I have dozens of lines of code that requires different levels of calculations just like in the example, only more of them.