If command in cloverleaf

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf If command in cloverleaf

  • Creator
    Topic
  • #50304
    Shehbaz Khan
    Participant

      i want to test something like this….

      I have a list of nursing units, and i want to check if the nursing unit i am getting is one from the list……

      if ( [string match [A B C D] pv1.3.1 ] == 1   )

      my question is……Is it possible to do it with the if operator in cloverleaf translation???

      if yes than how?

      Thanks in advance

      and please pardon any stupidity you may find…i am just a new student. 🙂

    Viewing 3 reply threads
    • Author
      Replies
      • #65564

        You can not do it directly to my knowledge, but you can do it indirectly with tcl fragments or multiple if statements. Use a copy statement with your if statement in the tcl fragment and put the results in a temporary variable (ex. @flag). Then use an xlate if statement to check the value of the flag. I hope that makes sense …

        -- Max Drown (Infor)

      • #65565
        Jim Kosloskey
        Participant

          Shehbaz,

          Why not use a lookup Table?

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

        • #65566
          Shehbaz Khan
          Participant

            I end up using lots of if’s…..

            1(0).PV1.00133.[0] ne =OB1 &&

            1(0).PV1.00133.[0] ne =MHR &&

            1(0).PV1.00133.[0] ne =2TW &&

            1(0).PV1.00133.[0] ne =ME1 &&

            1(0).PV1.00133.[0] ne =ME2 &&

            1(0).PV1.00133.[0] ne =SU2 &&

            1(0).PV1.00133.[0] ne =ICU &&

            1(0).PV1.00133.[0] ne =CCU &&

            1(0).PV1.00133.[0] ne =DSP

          • #65567
            Bob Richardson
            Participant

              Greetings,

              Look at the lcontain (list contains) command in TCL, for example,

              you can do something like the following:

              set valid_depts “OB1 MHR 2TW ME1 ME2 SU2 ICU”

              (extract PV1-3.0)  set pv1_3_1 …

              if {[lcontain $valid_depts $pv1_3_1]} {

                do something

              }

              If your list does start to grow the table lookup option may be

              a better choice.  

              By the way you can play around with Tcl interactively to see what works best for you, that is, fire up a Tcl shell by keying >hcitcl OR >tcl and enter your commands.

              Good luck.

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