Support » Plugin: Calculated Fields Form » CHECK IF NOT EMPTY

• I am trying to make a rule in a calculated field so that until all the inputs are entered the calculation will not be done.

The inputs that are allowed include ‘0’, ‘1,’ upwards.

So I used this formula.

`if(fieldname1>=0&&fieldname2>=0&&fieldname3>=0&&fieldname4>=0&&fieldname5>=0&&fieldname6>=0&&fieldname7>=0&&fieldname8>=0&&fieldname9>=0&&fieldname10>=0) return`

Yet, the calculation is being done even when all the fields are not filled.

I noticed that by default all the empty values are same as 0 that is why the rule is not working. Is there anyway else I can go about this?

Viewing 3 replies - 1 through 3 (of 3 total)
• This is the full formula I used.

``````(function(){

if(fieldname1>=0&&fieldname2>=0&&fieldname3>=0&&fieldname4>=0&&fieldname5>=0&&fieldname6>=0&&fieldname7>=0&&fieldname8>=0&&fieldname9>=0&&fieldname10>=0) return PREC((fieldname1+fieldname2+2*(fieldname3+fieldname4+fieldname6+fieldname5))/(fieldname8+2*(fieldname10+fieldname9+fieldname7)),2);

})()``````

Hello @graicifyd

In javascript the equality `0 == ''` returns true. So, you must check the fields by using the “|r” modifier for raw combined with your current conditions. The equation would be similar to:

``````(function () {
if(
fieldname1|r !== '' && 0 <= fieldname1 &&
fieldname2|r !== '' && 0 <= fieldname2 &&
fieldname3|r !== '' && 0 <= fieldname3 &&
fieldname4|r !== '' && 0 <= fieldname4 &&
fieldname5|r !== '' && 0 <= fieldname5 &&
fieldname6|r !== '' && 0 <= fieldname6 &&
fieldname7|r !== '' && 0 <= fieldname7 &&
fieldname8|r !== '' && 0 <= fieldname8 &&
fieldname9|r !== '' && 0 <= fieldname9 &&
fieldname10|r !== '' && 0 <= fieldname10
)
return PREC((fieldname1 + fieldname2 + 2 * (fieldname3 + fieldname4 + fieldname6 + fieldname5)) / (fieldname8 + 2 * (fieldname10 + fieldname9 + fieldname7)), 2);
})()``````

Best regards.

Oh wow.

Thank you so much, this is really helpful.

Viewing 3 replies - 1 through 3 (of 3 total)
• You must be logged in to reply to this topic.