Support » Plugin: Calculated Fields Form » need assistance to create formula

  • Resolved donowhattodo

    (@thuruga_deviyahoocom)


    Hello there.
    first of all i would like to thank you for this great plugin.
    i am in the midst of creating a form. please assist me with the calculation below:

    fieldname1: 1,2-3,4-7,above 8
    fieldname2: 100
    fieldname3: 200
    fieldname4: 300
    fieldname5: 400

    calculated field: if they select 1 then the value is fieldname2
    if they select (2 OR 3) then the value is (fieldname1*fieldname3)
    if they select (4,5,6,OR 7) then the value is (fieldname1*fieldname4)
    if they select (above 8) then the value is (fieldname1*fieldname5)

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

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

    (@codepeople)

    Hi,

    I suppose the fieldname1 is a radio button group, or a drop-down field, with options’ values:1,2,3,4,5,6,7,8,…

    So the equation would be:

    (function(){
    if(fieldname1 == 1) return fieldname2;
    if(fieldname1 == 2 || fieldname1 == 3) return fieldname1*fieldname3;
    if(fieldname1 == 4 || fieldname1 == 5 || fieldname1 == 6 || fieldname1 == 7) return fieldname1*fieldname4;
    if(fieldname1 >= 8) return fieldname1*fieldname5;
    })();

Viewing 1 replies (of 1 total)
  • The topic ‘need assistance to create formula’ is closed to new replies.