Logic to change segments based on text in report

Clovertech Forums Read Only Archives Cloverleaf General Logic to change segments based on text in report

  • Creator
    Topic
  • #52506
    Kirby Knight
    Participant

      Has anyone done this type of thing in a Xlate?

      The requirement is as follows:

      The conclusion section of a report needs to be identified by &IMP in OBX_3.  &GDT will be in OBX_3 for everything preceding the conclusion.  

      GDT

    Viewing 4 reply threads
    • Author
      Replies
      • #74493
        Jim Kosloskey
        Participant

          Kirby,

          Need more detail.

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

        • #74494
          Kirby Knight
          Participant

            OBX|1|TX|&GDT||Sample result indicating a line of FINDINGS text.||||||

            OBX|2|TX|&GDT||This OBX indicates a 2nd line of FINDINGS text.||||||

            OBX|3|TX|&IMP||Sample result indicating the CONCLUSION text.||||||

            OBX|4|TX|&IMP||More sample result indicating the text.||||||

            OBX|5|TX|&IMP||Still More sample result indicating the text.||||||

            So my question is, would the best solution be to put an IF condition with in the OBX iteration that looks for the appearance of the word CONCLUSION?

            Have you done something like this before?

          • #74495
            Jim Kosloskey
            Participant

              Kirby,

              I am assuming the OBXs shown are what the outbound should look like.

              I have done some similar things.

              I would try using an IF Action if you are on a release of Cloverleaf that has the ‘Contains’ option in the string compare.

              I would use a temp variable to set the value for OBX-3 (GDT or IMP) based on the discovery  of CONCLUSION. I would do this such that the GDT is the normal and only gets reset when the discovery of CONCLUSION happens.

              Be aware the standard (at least beginning with 2.3) does not specify sub-components for OBX-3 yet that appears to be what is being demanded here (assuming & is the sub-component separator in MSH-2).

              However you can use sub-component notation in your COPY Action when COPYing the temp variable to OBX-3 to force this non-compliance.

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

            • #74496
              Kirby Knight
              Participant

                Thanks Jim,

                The & in &GDT is not a sub component separator and I do not have a CONTAINS option in string comparison.

                I have it working, check my logic please.  Is there a better way I should set this up?

                  Created the following variables

                    for OBX_3 with a default value of &GDT

                    @conclusion=CONCLUSION:

                 

                  Within the iteration

                       Created a variable to capture the value of OBX_5  = @OBX5

                       Copied @OBX3 to OBX_3

                       Created an if statement =   @OBX5 eq @conclusion

                             sets @OBX3=&IMP

              • #74497
                Jim Kosloskey
                Participant

                  Kirby,

                  The string in OBX-3 you are comparing to contains the value CONCLUSION a eq compare wil not be true.

                  If the release of Cloverleaf you are on does not have the contains value, then you will need a Tcl proc to do the compare.

                  I have a couple of procs that will do that – one using regsub, the other string map.

                  If you would like copies of them for an example, email me.

                  And the & is a subcomponent seperator if the & is specified in MSH-2.

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

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