Calculated attribute showing value despite nothing in input fields

0
I have 3 fields on a form, 2 are input A,B and the 3rd one is calculated. So on change of A and B , a microflow is triggered. Condition(check if A and B are not empty or >0),  → Set value for C = $A : $B So after setting this up in application when i open form and input values A and B, C is calculated correctly. But if i change A and B to 0, C remains as it is. i.e. Value of C was 2 when A=10 and B=5. Then when i make A =0 and B=0, it doesn't change.  If i input some other value(apart from 0), then again C recalculates. How can i fix this, so that if A and B are changed to 0 after first calculation C should also calculate. Could this be because of the >0 condition?
asked
3 answers
0

Create an extra else if statement that will handle the situation of:

case $a = 0 or $b = 0

In that case change $c to 0 as well. 

answered
0

If you set B to 0, you’ll be trying to divide by 0 which is impossible. 

As the condition says, you need to make sure A and B are are not empty or 0.

answered
0

Pragya,

The issue that I see is, once you have set the value, how are you resetting it? Your condition says calculate C only when A or B is >0, then only you are calculating. So, in you case, when you calculate C =2 and then you changed both A & B to zero, the condition of either A or B>0 is not being met.

So. the solution is:

You should check:

If  B!=0 then

C=A/B

else If B=0, C=’’

 

answered