• Resolved aesch777

    (@aesch777)


    Hi I am trying to create a calculation amount based on the following answers on the form:
    -their annual income (fieldname 2)
    -their monetary assets (fieldname 3)
    -number of people in their household (fieldname16)
    -status (Single or Married) (Fieldname15)
    -Financing Plan (Yes or No) (fieldname20)

    This is what I got so far, any suggestions, corrections, or help would be greatly appreciated!

    a)
    Condition:

    If one person household (fieldname16), with NO finance plan (fieldname20), annual income is less than $15,000 (fieldname 2) and monetary assets is less than $3000 (fieldname 3) = value is 7000

    Code:
    if(fieldname16 < 2 && fieldname20 == No && fieldname2 < 15000 && fieldname3 < 3000) return 7000;

    b)
    Condition:

    If one person household, with a finance plan, annual income is less than $15,000 and monetary assets is less than $3000 assets = value is 8400

    Code:
    if(fieldname16 < 2 && fieldname20 == Yes && fieldname2 < 15000 && fieldname3 < 3000) return 8400;

    c)
    Condition:

    If one person household, with NO finance plan, annual income is between $15,000 and $35000, monetary assets is less than $3000 assets = value is 9000

    Code:
    if(fieldname16 < 2 && fieldname20 == No && fieldname2 >= 15000 && fieldname2 <=35000 && fieldname3 < 6000) return 9000;

    d)
    Condition:
    If one person household, with a finance plan, annual income is between $15,000 and $35000, monetary assets is less than $3000 assets = value is 10800

    Code:
    if(fieldname16 < 2 && fieldname20 == Yes && fieldname2 >= 15000 && fieldname2 <=35000 && fieldname3 < 6000) return 10800;

    e)
    Condition:
    If one person household, with NO finance plan, annual income is more than $35,000, monetary assets is less than $3000 assets = value is 11000

    Code:
    if(fieldname16 < 2 && fieldname20 == No && fieldname2 < 35000 && fieldname3 < 3000) return 11000;

    f)
    Condition:
    If one person household, with a finance plan, annual income is more than $35,000, monetary assets is less than $3000 assets = value is 13200

    Code:
    if(fieldname16 < 2 && fieldname20 == Yes && fieldname2 < 35000 && fieldname3 < 3000) return 13200;

    g)
    Condition:
    If married or two person household, with NO finance plan, annual income is less than $25000 and monetary assets is less than $5000 assets = value is 7000

    Code:
    if(fieldname16 > 1 && fieldname ==Yes fieldname20 == No && fieldname2 < 25000 && fieldname3 < 5000) return 7000;

    h)
    Condition:
    If married or two person household, with a finance plan, annual income is less than $25000 and monetary assets is less than $5000 assets = value is 8400

    Code:
    if(fieldname15 == Married || fieldname16 > 1 && fieldname20 == Yes && fieldname2 < 25000 && fieldname3 < 5000) return 7000;

    i)
    Condition:
    If married or two person household, with NO finance plan, annual income is between $25000 and $50000, monetary assets is less than $10000 assets = value is 9000

    Code:

    if(fieldname15 == Married || fieldname16 > 1 && fieldname20 == No && fieldname2 >= 25000 && fieldname2 <= 50000 && fieldname3 < 5000) return 9000;

    j)
    Condition:
    If married or two person household, with a finance plan, annual income is between $25000 and $50000, monetary assets is less than $10000 assets = value is 10800

    Code:

    if(fieldname15 == Married || fieldname16 > 1 && fieldname20 == Yes && fieldname2 >= 25000 && fieldname2 <= 50000 && fieldname3 < 10000) return 10800;

    k)
    Condition:
    If married or two person household, with NO finance plan, annual income is more than $50000, monetary assets is more than $10000 assets = value is 11000

    Code:
    if(fieldname15 == Married || fieldname16 > 1 && fieldname20 == No && fieldname2 > 50000 && fieldname3 > 10000) return 11000;

    l)
    Condition:
    If married or two person household, with a finance plan, annual income is more than $50000, monetary assets is more than $10000 assets = value is 13200

    Code:
    if(fieldname15 == Married || fieldname16 > 1 && fieldname20 == Yes && fieldname2 > 50000 && fieldname3 > 10000) return 13200;

    **Objective: All in one Calculation so all conditions are met and a value is given to the user.

    Thanks everybody!

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

    (@codepeople)

    Hello @aesch777,

    Unfortunately it is not possible to implement all users projects for free, however, in your conditional statement the piece of code: (fieldname2 < 25000 && fieldname2 <= 5000) has no sense, because if fieldname2 is lesser than 25000, it would be lesser than 5000 too.

    Best regards.

Viewing 16 replies (of 16 total)
  • The topic ‘If statements, Multiple Conditions, && and ||’ is closed to new replies.