Hi all,
I try to create a loop to calculate Factorial math function…
It works sometimes but the mathematical calculation can change and I don’t know why. May be it’s due to the type of the variable (numeric vs text) ?? Is it possible to change the text variable into a numeric variable to be sure that the calculation is good ?
Do you have another idea why the calculation can change ?
Thanks…
In the screen you can see the loop to calculate the factorial of the sum 1, 2, 3 and 4.
And the result…
The sum of the row 1 is 2 (Tot A = 1 + 1) and correct and the factorial gives 6
The sum of the row 2 is 4 (Tot B = 2 + 2) and correct but the factorial gives 360 !!!
If you want to ensure that a text variable is interpreted as a number, add 0 to it. That will convert the value to a scalar.
That said, with your loops, you keep multiplying a variable (‘ap’, ‘bp’, ‘cp’, etc) by a coefficient and assigning it back to itself. The question is: how do you ensure that “ap” does not have a pre-existing value? Do you start by initializing them to 1 before multiplying with anything?
Hello,
May be I missed something… When I try to run your procedure, the result is one… Where is my mistake ?
TEFA is my Input field
label44 my label
ap is my variable (-> number)