IfElse (Calculated value in Formula Builder)

Hi. Very new to formula builder and calculations. Any help would be great, can't seem to figure where I'm going wrong.

$expensetype_c - Dropdown (AnnualTerm/AdjustedTerm)
If AnnualTerem ($annualmonths_c) Integer field, prepopulated with 12, readonly
If AdjustedTerm ($adjustednumberofmonths_c) Open to any numeric value 1 to 11

NumberOfMonths =
- If AnnualTerm then use the value of AnnualTerm ($annualmonths_c)
- ElseIf AdjustedTerm then use the value of AdjustedTerm ($adjustednumberofmonths_c).

Version 1:

ifElse(equal($expensetype_c),"AnnualTerm"),$numbermonthslraunvouched_c,$annualmonths_c),
ifElse(equal($expensetype_c),"AdjustedTerm"),$numbermonthslraunvouched_c,$adjustednumberofmonths_c))

Error:- ifElse: Syntax Error (Improperly Terminated String ')')34 35


I will have many fields reading the same Expesnse Type Dropdown so would like to either use either of the values based on Expense Type so this would be a massive help if solved!!.

Thanks a mil, Sean

Parents
  • before diving into specifics...
    as I remember there should be 2 parameters to compare for equal() 
    e.g. could it be that equal($expensetype_c),"AnnualTerm" should be like equal($expensetype_c,"AnnualTerm") ?

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient

  • Appreciate the reply and Info Dmytro!.. l wouldn't have picked up on that!  Possibly helped that error but getting another! 

    No worries if error not visible to you!

    ifElse(equal($expensetype_c,"AnnualTerm"),$numbermonthslraunvouched_c,$annualmonths_c),
    ifElse(equal($expensetype_c,"AdjustedTerm"),$numbermonthslraunvouched_c,$adjustednumberofmonths_c))

    Error - equal($expensetype_c,"AdjustedTerm": Syntax Error, no close parentheses found

    Regards

    Sean

  • not sure that I understood all the requirements, but the formula may look like this

    ifElse(equal($expensetype_c,"AnnualTerm"),$annualmonth_c,
    ifElse(equal($expensetype_c,"AdjustedTerm"),$adjustednumberofmonths_c,0))

    I preconfigured your example here https://sg-example01.demo.sugarcrm.eu/ (login admin, password asdf) for the Notes module
    You are welcome to login and try to create new Note to check the behavior, then check fields specifications in Studio

    Let me know if that helps or any questions remain

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient

Reply Children