How to do IF / COPY

Clovertech Forums Cloverleaf How to do IF / COPY

  • Creator
    Topic
  • #116459
    Anna Fleeger
    Participant

      I am trying to replace the code in OBR #4 [0] based on the text in OBR #4 [1]

       

      If the text is   PREPARE CONVALESCENT PLASMA   then I need the first field to be   CON

    Viewing 3 reply threads
    • Author
      Replies
      • #116460
        Rob Abbott
        Keymaster

          Try this:

           

          IF OBR#4.[0] eq =PREPARE COONVALESCENT PLASMA

          COPY =CON –> OBR#4.[0]

          Rob Abbott
          Cloverleaf Emeritus

        • #116461
          Vince Angulo
          Participant

            This can be troublesome because PREPARE CONVALESCENT PLASMA is a string with spaces…

            Create a variable with your string:

            COPY =PREPARE CONVALESCENT PLASMA -> @TestString

            Create a variable with OBR-4.1:

            COPY OBR-4.1 -> @OBRText

            If @OBRText eq @TestString  THEN COPY OBR-4.0 -> OBR-4.1

          • #116462
            Jim Kosloskey
            Participant

              Is that the only value in OBR-4.2 that need to have something in OBR-4.1?

              Xlate I am assuming.

              If that is the only value then a simple IF Action:

              IF OBR-4.2 (use appropriate address path here) eq =PREPARE CONVALESCENT PLASMA

              COPY =CON to OBR-4.1 (use appropriate address path here).

              On some releases of Cloverleaf you may need to COPY the value PREPARE CONVALESCENT PLASMA to a temp variable first and then do the IF against the temp variable.

              If there could many relationships of text in OBR-4.2 to a value or set of values in OBR-4.1 then a Table would be the best bet. No IF needed then just a TABLE Action.

               

              email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.

            • #116469
              Anna Fleeger
              Participant

                Thanks to everyone to responded to my question.

                We went with Jim’s suggestion of going with a table because there could be additional codes that will need to be converted.  Here are the steps we took to determine if the result text was what we were looking for, and if so, to update the result code:

                1. created a table with the result text requiring a special code in the IN side and the desired replacement result code in the OUT side.  The Use Default Value is selected, and allowed to stay Null.
                2. in the xlt enter TABLE operation, use text in OBR.4[1] as the Source, with the new table, write the Destination value to a variable
                3. using IF operation, if the variable value is NOT null, use the variable as the Source, and COPY the value to the OBR#4[0]

                 

                Many thanks to Jim for his additional support!

            Viewing 3 reply threads
            • You must be logged in to reply to this topic.