0

How to get several conditions like a "CASE" fonction

I want to trig a calculation depending on a 'selection' value. 

I want to use several If Then (else) End but it seem I can't use more than one in the same command ???

I can't find the way, so please help me. Regards

3 replies

null
    • Nick
    • 5 yrs ago
    • Reported - view

    From the manual (for multiply if statements):

     

    if Age < 18 then "Child" else "Grown-up" end

    if Age < 18 then
           if Age < 13  then "Child" else "Teenager"
    else "Grown-up"
    end

     

    For a "Case" function look at "switch" command:

    (Date is a Date field)

    switch weekday(Date) do
    case 0:
    text("Monday")
    case 1:
    text("Thuesday")
    case 2:
    text("Wednesday")
    case 3:
    text("Thursday")
    case 4:
    text("Friday")
    case 5:
    text("Saturday")
    case 6:
    text("Sunday")
    default:
    text("")
    end

    • pascaltemps.1
    • 5 yrs ago
    • Reported - view

    Concerning the 'if then end' block, I can't add any other instruction before or after when using ?

    The same inside the condition, I can't send several instruction after "then" and "else" ? only one ?

    Thank's a lot, not so easy to find in your manual !

    • pascaltemps.1
    • 5 yrs ago
    • Reported - view

    Sorry, it's OK, I forgot the ";" at the end of insctruction 😇

Content aside

  • 5 yrs agoLast active
  • 3Replies
  • 1447Views