• Resolved Laverneus Dinglefoot

    (@laverneus-dinglefoot)


    I have looked through the support questions and haven’t found one that matches this description completely, although many come close.

    I am trying to recreate the NFL passer rating calculator, wherein the four main variables are capped at 0 min and 2.375 max.

    I need something to the effect of IF(fieldname70 >= 2.375,2.375)
    If(fieldname70 <= 2.375,fieldname70)

    I have seen this format:

    (function(){
    if(fieldname70 >= 2.375) return 2.375;
    if(fieldname70 <= 2.375) return fieldname2;
    else return fieldname2;
    })()

    However, I don’t want the rule to apply to every form I create that happens to have a fieldname70 in it. I need to apply it specifically to one form.

    Plus, I tried the above code and created a fatal error, so I might be doing something wrong entirely.

    Your help is appreciated.

    https://www.ads-software.com/plugins/calculated-fields-form/

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

    (@codepeople)

    Hi,

    The equations defined in a form will be applied only to this form.

    We have made an update to correct the number of cents in the currency fields, and remove other conflictive characters on fields, so I recommend you reinstall the plugin. Don’t worry the reinstallation preserves the forms created previously:

    1. Go to the plugins section in WordPress, and deactivate the current version of Calculated Field, and then press the “Delete” button associated to it.

    2. Press the “Add New” button at top of section, search the Calculated Field, and install and activate the plugin again.

    3. Finally, go to the form’s definition, and use the following equation:

    (function(){
    if(fieldname70 >= 2.375) return 2.375;
    if(fieldname70 < 2.375) return fieldname2;
    })()

    That’s all.
    Best regards.

    Thread Starter Laverneus Dinglefoot

    (@laverneus-dinglefoot)

    I am going to ask what is probably a dumb question. What do you mean by “go to the form’s definition?”

    Plugin Author codepeople

    (@codepeople)

    Hi,

    I’m sorry, I should say the form’s settings.

    In the settings page of plugin there are a list of all forms created in your website, each form has associated a “settings” button. Press the settings button of form to modify, and use the equation I sent you in the calculated field.

    Best regards.

    Thread Starter Laverneus Dinglefoot

    (@laverneus-dinglefoot)

    I appreciate it. Sorry for the silly questions…I just found out about the internet like 8 days ago. I’ll get the hang of it.

    Plugin Author codepeople

    (@codepeople)

    Hi,

    Don’t worry, is a pleasure to help you.

    Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Localized IF function’ is closed to new replies.