IfElse Formula to Calculate Percentage

Hello, 

I'm trying to create an ifelse function that calculates a different percentage of the Contract Price based on the State.

I tried the following, but am receiving an error of "Cannot read property 'returnType' of undefined"

 

ifElse(equal($estate_state_c),"QLD"),multiply(0.25,$contract_price_c),

ifElse(equal($estate_state_c),"NSW"),multiply(0.35,$contract_price_c),

ifElse(equal($estate_state_c),"VIC"),multiply(0.35,$contract_price_c)))

Can someone point out what I am doing wrong?

Thanks in advance!

Parents
  • 2 bugs:

    1) too much parenthesis, equal($estate_state_c) not really makes sense, but I suppose that's a copy/paste bug.

    2) the else-else-else part is missing, when estate_state is not QLD, NSQ or VIC, you need a return value and that is empty in your formula but must be of type currency.

    So try this formula:

    ifElse(equal($estate_state_c,"QLD"),multiply(0.25,$contract_price_c),
    ifElse(equal($estate_state_c,"NSW"),multiply(0.35,$contract_price_c),
    ifElse(equal($estate_state_c,"VIC"),multiply(0.35,$contract_price_c),0)))

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

Reply
  • 2 bugs:

    1) too much parenthesis, equal($estate_state_c) not really makes sense, but I suppose that's a copy/paste bug.

    2) the else-else-else part is missing, when estate_state is not QLD, NSQ or VIC, you need a return value and that is empty in your formula but must be of type currency.

    So try this formula:

    ifElse(equal($estate_state_c,"QLD"),multiply(0.25,$contract_price_c),
    ifElse(equal($estate_state_c,"NSW"),multiply(0.35,$contract_price_c),
    ifElse(equal($estate_state_c,"VIC"),multiply(0.35,$contract_price_c),0)))

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

Children