Tps testing error

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Tps testing error

  • Creator
    Topic
  • #51055
    Scott Smith
    Participant

      I am getting and error during thru the tps testing tool (gui)

      the error: result = ‘wrong # args: extra words after “else” clause in “if” command’

      Here is my “If statement”:

      if {[string equal $MSH8 “A08″]} && {[string equal $PV131 ” “]} {

                                 set dispList

                                }

                                else {

                                   set dispList

                               }

                             

                               if {[string equal $PV132 “B7E”]} {

                                   set dispList

                               } else {

                                   set dispList

        I think it is the &&, but I just can’t see it.

    Viewing 7 reply threads
    • Author
      Replies
      • #68615
        Jim Kosloskey
        Participant

          Scott,

          I think you are missing a closing curly brace after the second if/else.

          If you have an editor that lets you check for termination pairs ([ and { for example), use that to check to make sure you have matched pairs.

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #68616
          Scott Smith
          Participant

            I found them they are there, just after 2 echos I put in here is the entire statement:

            if {[string equal $MSH8 “A08″]} && {[string equal $PV131 ” “]} {

                                       set dispList

                                      }

                                      else {

                                         set dispList

                                     }

                                   

                                     if {[string equal $PV132 “B7E”]} {

                                         set dispList

                                     } else {

                                         set dispList

               

                                   

               

               echo $mh    

               echo $dispList

               }

          • #68617
            Charlie LaBaw
            Participant

              I believe you need to remove the } { which are to the left and right of &&. Also, the }

                             else {

              should probably be } else {.

            • #68618

              Code:

              if {[string equal $MSH8 “A08″] && [string equal $PV131 ” “]} {
                # …
              }

              -- Max Drown (Infor)

            • #68619
              Scott Smith
              Participant

                Moving the brackets fixed one error now I get:

                rong # args: no script following “{[string equal $MSH8 “A08″] && [string equal $PV13” argument’

              • #68620
                Charlie LaBaw
                Participant

                  I was able to run the following with no errors:

                  set MSH8 A08

                  set PV131 {0}

                  set PV132 B7x

                  set mh message

                  if {[string equal $MSH8 “A08″] && [string equal $PV131 ” “]} {

                     set dispList

                    } else {

                       set dispList

                    }

                                       

                    if {[string equal $PV132 “B7E”]} {

                       set dispList

                    } else {

                       set dispList

                    }

                    puts “dispList: $dispList”

                • #68621
                  David Barr
                  Participant

                    Max Drown wrote:

                    if {[string equal $MSH8 “A08″] && [string equal $PV131 ” “]} {
                    [code]if {[string equal $MSH8 “A08″] && [string equal $PV131 ” “]} {

                  • #68622
                    Chris Williams
                    Participant

                      As Charlie L mentioned, whenever you use “else” it must appear on the same line with the braces on either side:  “} else {“. Otherwise the “if” statement will not be associated with the “else”.

                  Viewing 7 reply threads
                  • The forum ‘Cloverleaf’ is closed to new topics and replies.