# WordPress.org

## Calculated Fields Form[resolved] If and Else integration (8 posts)

1. Dinitrophenol
Member
Posted 1 year ago #

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:)

2. codepeople
Member
Plugin Author

Posted 1 year ago #

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){
}
})()

3. Dinitrophenol
Member
Posted 1 year ago #

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

4. codepeople
Member
Plugin Author

Posted 1 year ago #

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){
}
})()

5. Dinitrophenol
Member
Posted 1 year ago #

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.

6. codepeople
Member
Plugin Author

Posted 1 year ago #

Hi,

http://wordpress.dwbooster.com/support

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

Best regards.

7. Dinitrophenol
Member
Posted 1 year ago #

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

8. Dinitrophenol
Member
Posted 1 year ago #