Setting a Flag(temp variable) in a XLT Iterate

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Setting a Flag(temp variable) in a XLT Iterate

  • Creator
    Topic
  • #48633
    Paul Johnston
    Participant

      In a XLT is it possible to set a Flag ( to Y or N ) in a ITERATE  on its first iteration and then check the Flag on the second Iteration .

      Thanks

      Paul

    Viewing 3 reply threads
    • Author
      Replies
      • #59241
        Paul Johnston
        Participant

          My original solution of COPY =Y to @Chk2 works.

          On subsequent iterations I perform an If @Chk2 eq =Y

          Can’t get much simple than that .

          For some reason this simple solution was not working earlier and thats

          when I was became puzzled and posed my question.

          Paul

        • #59242
          Robert Kersemakers
          Participant

            Hi Paul,

            I often forgot to initialize the Flag before the iteration. When checking this Flag, Cloverleaf would give an error because the Flag-variable was unknown.

            Maybe that’s the case here also?

            Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

          • #59243
            Anonymous
            Participant

              Paul,

              I think the problem may be in your IF statement.  Personally, I have found that if I try to access something like “YES” or “NO” in an IF statement inside an xlate, that the engine doesn’t like it if I say something like “IF @OBX_FLAG eq =Y”.  

              Instead I use two “@” variables in my comparison.  I have a variable I use in an iterate for an OBX flag.  Here is how I do it.

              First, I declare my variables outside the iteration:

                 COPY =NO    @OBX_FLAG

                 COPY =YES   @YES

                 COPY =NO    @NO

              Second, I set up my IF statement as:

                 IF @OBX_FLAG eq @NO

              Third, in a copy statement, I check a certain feild for the FLAG condition in a Tcl fragment and if the condition is true, then I set my xlatOutVals to change my @OBX_FLAG to YES.

                COPY  1(0).1(0).1(%g1).OBX.#3  @OBX_FLAG

              It seems a bit cumbersome, but it is the only way I could get the IF statement to work and believe me, I tried every way under the sun.  If anyone has any other suggestions, please let me know.

              Thanks…

              Thomas G. Rioux

              The Methodist Hospital

            • #59244
              Paul Johnston
              Participant

                Thomas,

                Thanks for your reply . I thought my solution was working but I determined later on the results were not consistent .

                I tried your solution and I believe it is much better.

                Thanks again for your technique.

                Hopefully I can remember it for the next time.

                Paul

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