You are viewing limited content. For full access, please sign in.

Question

Question

Forms Calculation dividing.

asked on August 26, 2016 Show version history

The Gain field as you can see is blank.  This is because it is using Forms calculator as such:

 

= growth_feed / growth_fcr

They all have default values set at 0.00

Granted I know you can't Divide by zero, so the Gain calculation is essentially an error and doesn't fill anything.  Is there a way to have FCR be shown as zero and for gain to also be shown as zero unless modified.  I didn't want to put 0.01 or something for FCR if by chance it doesn't get modified then it will be inaccurate for them actually having some placeholder value.

 

 

 

0 0

Answer

SELECTED ANSWER
replied on August 26, 2016

Hi Chase,

Try using this for the formula for the Gain field (can be in a single line, broken up for clarity):

=IF(
    EQ(growth_fcr,0),
    0,
    growth_feed / growth_fcr
)

This checks whether FCR is 0 (first argument). If so, we won't try to divide by zero and will set the Gain field to also be 0 (second argument). Otherwise, we aren't dividing by zero and can find the quotient as desired (last argument).

In general you can use the formula IF(condition, value_if_true, value_if_false) as of Forms 10.0 Update 2 / Forms 10.1. (You could technically use it before then, but there was a slight bug which made certain logical cases misbehave.)

Hope this helps!

4 0

Replies

replied on August 26, 2016

Thanks much this was exactly what I was looking for!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.