0

Formel für ein Datumfeld einstellen

Ich möchte ein Sternzeichen automatisch in einem neuen Feld ermitteln lassen, sobald das Geburtsdatum eingegeben wurde.
Die Formel schein von der Syntax her korrekt zu sein, die Formel kann ich aber nicht abspeichern, es wird immer ein Fehler angezeigt in der Zeile (siehe rot), sobald es in die Auswahl geht. Verschiedene Varianten (when / case ) habe ich ausprobiert, aber ein abspeichern ist nicht möglich. Woran kann es liegen.
Zusatzinfo: Ich bin relativ neu in der Anwendung von Ninox.
Hier der code:

let month := month(Geburtsdatum);
let day := day(Geburtsdatum);

case
when (month = 3 and day >= 21) or (month = 4 and day <= 19) then "Aries"
when (month = 4 and day >= 20) or (month = 5 and day <= 20) then "Taurus"
when (month = 5 and day >= 21) or (month = 6 and day <= 20) then "Gemini"
when (month = 6 and day >= 21) or (month = 7 and day <= 22) then "Cancer"
when (month = 7 and day >= 23) or (month = 8 and day <= 22) then "Leo"
when (month = 8 and day >= 23) or (month = 9 and day <= 22) then "Virgo"
when (month = 9 and day >= 23) or (month = 10 and day <= 22) then "Libra"
when (month = 10 and day >= 23) or (month = 11 and day <= 21) then "Scorpio"
when (month = 11 and day >= 22) or (month = 12 and day <= 21) then "Sagittarius"
when (month = 12 and day >= 22) or (month = 1 and day <= 19) then "Capricorn"
when (month = 1 and day >= 20) or (month = 2 and day <= 18) then "Aquarius"
when (month = 2 and day >= 19) or (month = 3 and day <= 20) then "Pisces"
else ""
end

3 Antworten

null
    • Fred
    • vor 3 Wochen
    • Gemeldet - anzeigen

    Try:

    let xmonth := month(Geburtsdatum);
    let xday := day(Geburtsdatum);
    
    Switch true do
    case (xmonth = 3 and xday >= 21) or (xmonth = 4 and xday <= 19):
    "Aries"
    case (month = 4 and day >= 20) or (month = 5 and day <= 20):
    "Taurus"
    cae (month = 5 and day >= 21) or (month = 6 and day <= 20):
     "Gemini"
    case(month = 6 and day >= 21) or (month = 7 and day <= 22):
     "Cancer"
    case(month = 7 and day >= 23) or (month = 8 and day <= 22):
     "Leo"
    case(month = 8 and day >= 23) or (month = 9 and day <= 22):
     "Virgo"
    case(month = 9 and day >= 23) or (month = 10 and day <= 22):
     "Libra"
    case(month = 10 and day >= 23) or (month = 11 and day <= 21):
     "Scorpio"
    case(month = 11 and day >= 22) or (month = 12 and day <= 21):
     "Sagittarius"
    case(month = 12 and day >= 22) or (month = 1 and day <= 19):
     "Capricorn"
    case(month = 1 and day >= 20) or (month = 2 and day <= 18):
     "Aquarius"
    case(month = 2 and day >= 19) or (month = 3 and day <= 20):
     "Pisces"
    default:
    ""
    end
    

    More info at the documentation section. What the documents don't talk about is the true option for switches.

    I added the "x" in front of month and date since those are also Ninox commands. Good habit to not name variable to be the same as Ninox commands. So make sure to update all of the reference to the variable to the new name.

      • Anke_Mielke
      • vor 3 Wochen
      • Gemeldet - anzeigen

      thanks a lot...I did it, but I'm not able to save it. It seems, that there's something wrong (see red mark) but I'm not able to find out what's wrong.

      • Fred
      • vor 3 Wochen
      • Gemeldet - anzeigen

      sorry, switch should be lower case. I didn't see my mistake. all Ninox commands are lower case.