After updating with integer instead of string (Thank You), I am still having a challenge with a (If Condition).
Currently, I have…
a=column("pro_Arg1")
b=column("pro_Arg2")
c=column("pro_Arg3")
v=column("Value")
q=column("QTY")
if(isMissing(c))
q = (a)+((b)*(v))
if (a > 0)
q = (a)+((b)*(v)+(v/c))
round(toDouble(q),2)
q
But this is not giving me good results. I am certain my format is wrong. What if “c” is missing and
a > 0? I think this is where it is bombing out to give me 0 instead of a value.
" Please advise.
Yes, I can explain the logic.
Here we are creating variables from the dataset and I am naming them a,b,c, v, and q.
If variable c is missing or “0” or blank I use the equation q = (a)+((b)(v))
else
I use the equation q = (a)+((b)(v)+(v/c))
as long as a > 0.
As I type this response, I am thinking that instead of having If (a > 0)
I can replace this with else.
If a = 0, that would not hurt the equation at all. In the above missing c, I was avoiding a division by 0.
P.S. How are you executing the “Preformatted text option”?
I do understand, and that is perfect. I am testing the formula by saying that if a = 0, adding 2 to the equation, should result in a value of 2, and 0 if we add nothing.
5 if we add the value of 5 and 0 if we add nothing etc.
However, The value is not adjusting to the different logic I am applying to the formula
q = a
to be honest not sure what is the status of your testing now
I will try to explain logic. First if is for a values higher or equal to zero. So if a = o you will go there. Then it depends on c value. If c is different than missing and zero you will use first formula (q = a + b*v + v/c). Otherwise second (q = a + b*v). If a is smaller than zero you will have last formula calculated (q = a).