ifElse-Formular

hello,

i already searched for an answer, but non of the given Answers worked for me. I think i just dont get it. I hope someone can help me out!

I have a "yes" and "no"- drop-down. If the user say "yes" the date of an other (date)-field should change to 01.01. of the current year. If the user says "no", the (date)-field must stay clear so the user has to type a date in it. 

Many thanks in advance!

Parents
  • Hi Nina Ziemann

    Once try with the below formuls:

    ifElse(equal($field-name,"Yes"),date(concat(subStr(toString(today()),12,4),"-01-01")),
    ifElse(equal($field-name,"No"),date(""),date("")))

    Note: Make sure Date entering format match your date, am currently assumes that the date is given in the format like yyyy-mm-dd.

    Hope this Helps..!!

    Best Regards

    S Ramana Raju

  • Thank you very much for your help! Unfortunally it did not work. With this formulas the date is set to today and if I say "no" die date-field is still not fillable. My Date entering format is dd.mm.yyyy so I set it to "01.01.", right? Maybe its something other I have to change because I use the german Sugar?

  • Hi

    Check with this if your date format is dd.mm.yyy:

    ifElse(equal($field-name,"Yes"),date(concat("01.01.",subStr(toString(today()),12,4))),
    ifElse(equal($field-name,"No"),date(""),date("")))

    Hope this Helps..!!

    Best Regards

    S Ramana Raju

  • If it is much easier it also would help if the Date is automatically set to "01.01.2016" and on the 1.1.2017 i will chance 2016 to 2017, that would also be no problem for me... but i still dont understand why i cant change the date if i say "no" :/

  • I tested in my local, formula is working for me.

    Once cross check field Standard-Vertragslaufzeit dropdown both Iteam Name and Display Name same as "Nein" and "Ja"

    ifElse(equal($field-name,"Yes"),date(concat("01.01.",subStr(toString(today()),12,4))),
    ifElse(equal($field-name,"No"),date(""),date("")))

    Here in the above formula Yes / No are the Iteam Name from the Dropdown List. So manke sure you are giving Iteam Name only. Also value will be updated only after you click on Save button.

    Coming to "Why you cant change the date if you say NO" - coz for calculated field, we can no longer set the value manually in the Edit View. This field will be in disabled.

    Let me know for further help.

    Best Regards

    S Ramana Raju

  • ok thank you. If I cant change the field if i say no it doesn't make sense for us to make a formula at all.

    Thank you very much for your help!

Reply Children
No Data