6 Replies Latest reply on Nov 13, 2006 3:16 PM by Lukewig

    What is wrong with that?

    wgb14 Level 1
      Hi all

      I have the following case statement

      case true of

      (resulta = "Social_1.hap" or "Social_2.hap" ):

      tell dialogue to use

      (resulta = "use_1.hap" or "use_2.hap" ):

      tell dialogue to usetwo

      end case

      resulta is the name of the variable that is updated based on the value of the script that the system gets from the database. dialogue is a MIAW and use 1 and two are two scripts that should be executed once the resulta becomes one of the values. The problem is that the script stops executing in step 1 and it will not work when the variable becomes use1.hap or use_2.hap. I am not sure whay is that. I tried the other way around

      case true of

      (resulta = "Social_1.hap" or "Social_2.hap" ):

      tell dialogue to use
      end case
      case tru of
      (resulta = "use_1.hap" or "use_2.hap" ):

      tell dialogue to usetwo

      end case

      but it will ignore step 1 (the social_1.hap etc) and will execute directly step 2 (use_1.hap etc). Any solutions to this problem will be appriciated

      Many thanks
        • 1. Re: What is wrong with that?
          Lukewig Level 1
          Hi,

          Your test case isn't quite right - for example

          (resulta = "Social_1.hap" or "Social_2.hap" ):
          (resulta = "use_1.hap" or "use_2.hap" ):

          should be

          (resulta = "Social_1.hap" or resulta = "Social_2.hap" ):
          (resulta = "use_1.hap" or resulta = "use_2.hap" ):

          (Director isn't clever enough to assume that the second "or" question still applies to the subject of the first "or" question... you need to spell it out)

          -- Luke

          • 2. Re: What is wrong with that?
            wgb14 Level 1
            hi

            Nop it is not working that way either. Again director in the first step executes only the Social_2.hap, while it refuses to execute the second step completly.

            Any idea what is wrong?

            Thanks
            • 3. Re: What is wrong with that?
              duckets Level 1
              You have 'end case' twice in your code. You only need it once. See attached code below.

              hope this helps!

              • 4. Re: What is wrong with that?
                wgb14 Level 1
                Nop it won't work either. I am not sure what's wrong with that. Director now executes only the first half of the first step and refuses to execute the second step completely. Any ideas?

                Thanks
                • 5. Re: What is wrong with that?
                  duckets Level 1
                  perhaps you should use a 'put' statement to trace what 'resulta' actually does contain, before your 'case' statement, like this:

                  put "resulta="&resulta

                  then run your code, and see what is output to the message window.
                  hope this helps!

                  - Ben
                  • 6. Re: What is wrong with that?
                    Lukewig Level 1
                    > Director now executes only the first half of the first step

                    Not sure what you mean by this... Note that in Lingo (unlike some other languages, such as PHP), only the first matching case statement gets executes - not all the matching cases (and hence there is no 'break' statement).

                    Incidently, since you only appear to be checking the value contained in a single variable, you can write your case statement like this:


                    case resulta of
                    "Social_1.hap","Social_2.hap":
                    tell dialogue to use
                    "use_1.hap","use_2.hap":
                    tell dialogue to usetwo
                    end case