Support » Plugin: Calculated Fields Form » Problems with multiple formula

• Resolved rafael_linares

(@rafael_linares)

Hi,

I know that there are many questions regarding if issues, but none of them include multiple if formulas, and I have problems, how can I get the following results?

– I have Fieldname1 with 2 different options: “1” and “2”
– Fieldname2: is a numerical value (area)
– Fieldname3: are many different options in which I have assigned a numerical value
– Fieldname4: 2 options (0 and 30)

I want the following result:

if fieldname1 is 1 and fieldname2 is >0 and <50, I want to get sum of (100+fieldname3+fieldname4)

BUT if fieldname1 is 1 and fieldname2 is >50 and <100, I want to get sum of (200+fieldname3+fieldname4)

BUT if fieldname1 is 2 and fieldname2 is >0 and <50, i want to get sum of (300+fieldname3+fieldname4)

fieldname1 is 2 and fieldname2 is >0 and <50, i want to get sum of (400+fieldname3+fieldname4)

Note that fieldname3 and fieldname4 are words with numerical assigned values.

Rafael

http://wordpress.org/extend/plugins/calculated-fields-form/

Viewing 1 replies (of 1 total)
• Plugin Author codepeople

(@codepeople)

Hi,

That you require is a equation something more complex, use the following equation:

(function(){
if( fieldname1==1 && fieldname2 > 0 && fieldname2 < 50 )
return (100+fieldname3+fieldname4)
if( fieldname1==1 && fieldname2 > 50 && fieldname2 < 100 )
return (200+fieldname3+fieldname4)
if( fieldname1 == 2 && fieldname2 > 0 && fieldname2 < 50 )
return (300+fieldname3+fieldname4)
if(fieldname1 == 2 && fieldname2 > 50 && fieldname2 < 100 )
return (400+fieldname3+fieldname4)
})()

The previous code reproduce the equation described, but I think that some case are not present in the equation, for example the result when fieldname2 is equal to 0, or equal to 50, or greater than or equal to 100

Viewing 1 replies (of 1 total)
• The topic ‘Problems with multiple formula’ is closed to new replies.