Support » Plugin: Calculated Fields Form » If and Else integration

• Resolved Dinitrophenol

(@dinitrophenol)

Hi, first of all I bought your plugin two weeks ago and I must say that the investment is fully profitable.

Could you please correct me, I do not find the error.
So we have dimension A (FieldNameH x fieldnameL)*fieldnameQuantity.
From 0 to 150 is included, is multiplied by (( 0.19)+ 40)
Between 150 and 400 inclusive, is multiplied by ((0.19 )+ 80)
Beyond 400, multiply by 0.19
Thus, So I draft the following function:

(function(){if(((fieldname27*fieldname26)*fieldname57) <= 150){
((((fieldname27*fieldname26)*fieldname57)*0.19)+40)}else if(((fieldname27*fieldname26)*fieldname57) =>151 && <=400){
((((fieldname27*fieldname26)*fieldname57)*0.19)+80)}else if(((fieldname27*fieldname26)*fieldname57) > 400){
((((fieldname27*fieldname26)*fieldname57)*0.19)}
})()

The field is hopelessly empty, so please Moderator : pimp my function ! Thanks:)

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

Viewing 7 replies - 1 through 7 (of 7 total)
• Plugin Author codepeople

(@codepeople)

Hi,

The issue is very simple, you must to return the function’s result. I propose you an optimized version of your equation:

(function(){
var to_compare = fieldname27*fieldname26*fieldname57;
if(to_compare <= 150){
}else if(to_compare > 150 && to_compare <= 400){
}else if(to_compare > 400){
}
})()

Dinitrophenol

(@dinitrophenol)

There are no other variables involved in the equation and all necessary tags are there.
Where do you think the problem come ?
Thanks

Plugin Author codepeople

(@codepeople)

Hi,

I’m sorry, I forgot remove a parenthesis:

(function(){
var to_compare = fieldname27*fieldname26*fieldname57;
if(to_compare <= 150){
}else if(to_compare > 150 && to_compare <= 400){
}else if(to_compare > 400){
}
})()

Dinitrophenol

(@dinitrophenol)

It does not work either.
I controlled the fieldname26 27 57 (height x width x quantity) and the price variable, but still no figure in the field result.
Would you have another function please? May be different way.

Plugin Author codepeople

(@codepeople)

Hi,

http://wordpress.dwbooster.com/support

I’ll need the WordPress access for checking the form structure.

Best regards.

Dinitrophenol

(@dinitrophenol)

Of course, thanks for your help.
Contact sheet is done. I will post your equation solution here to help any need it.
Many Thanks

Dinitrophenol

(@dinitrophenol)