easy expression question

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf easy expression question

  • Creator
    Topic
  • #51422
    Mark Perschbacher
    Participant

    The generous forum users  helped me put this expression together to grab all the OBX 5 values starting with FINAL CYTOLOGIC DIAGNOSIS: and ending with The HPV Hybrid Capture, and what I am trying to do now is have the proc grab these values if The HPV Hybrid Capture is found, but if not grab all the OBX 5 values up to (Electronically Signed).  I tried adding an AND statement after {set bool 1} and placing an ELSE after the HPV Hybrid Capture string, but I got an “extra characters after ELSE error.  By toggling the {set boot 0} line on or off, I can get the proc to return the desired data, I just can’t figure out how to code it.  Any ideas?

    if {[string first “FINAL CYTOLOGIC DIAGNOSIS:” $field] >=0} {set bool 1}

         

    if {$field == “The HPV Hybrid Capture II assay is a signal amplification nucleic acid method”} {set bool 0}

    #if {$field == “(Electronically Signed)”} {set bool 0}

    if $bool {

    append obxlist “$field”

    }

Viewing 5 reply threads
  • Author
    Replies
    • #70224
      Jason Garrant
      Participant

      Hi Mark,

      Try this:

      if {[string equal “FINAL CYTOLOGIC DIAGNOSIS:” $field]} {

        set bool 1

      } elseif { [string equal “The HPV……” $field]} {

        set bool 0

      } elseif {[string equal “(Electron….” $field]} {

        set bool 0

      } else {

      }

      if {[string equal $bool 1]} {

        lappend obxlist $field

      }

    • #70225
      Mark Perschbacher
      Participant

      Jason, thanks for your reply.  I just realized that (Electronically Signed) appears on all reports, The HPV Hybrid does not.  The second elseif is always true using this code.

    • #70226
      Jason Garrant
      Participant

      Hi Mark,

      I might be confused about what you are looking for, but if you are saying if the HPV line is somewhere in the list, then take the whole list.  If HPV is not anywhere in the list then take up to the electronic sig line.  The following code will accomplish this.

      Code:

      set foundHPV “”
      set obxlist “”
      foreach item $originalList {
        if {[string equal “The HPV…” $item]} {
           set foundHPV 1
        }
      }

      if {![string equal $foundHPV 1]} {
        set stopRequest 0
        foreach line $originalList {
           if {[string equal “(Electron…” $line} {
              set stopRequest 1
           } else {
           }
           if {[string equal $stopRequest 0]} {
              lappend obxList $line
           } else {
           }
        }
      } else {
        set obxList $originalList
      }

    • #70227
      Mark Perschbacher
      Participant

      Jason, here is a sketch of the data

      …..

      …..

      FINAL CYTOLOGIC DIAGNOSIS

      ……

      ……..

      ……..

      (Electronically Signed)

      ………..

      PROCEDURE/ADDENDA:

      ……..

      ………

      The HPV Hybrid

      What I am trying to do is grab everything from FINAL CY…. to (Electron.., unless PROCEDURE/ADDENDA: is there.  If it is found, then continue copying data down to The HPV Hybrid

    • #70228
      Jason Garrant
      Participant

      Assumptions:

      1. orignialList is the list of segments from FINAL Cytology to the end of list

      2. obxList is the list that will be contain the final list of obx.5’s that will be sent out.

      Code:

      set foundAddenda 0

      set obxlist “”

      #loop through list of obx.5’s looing for the addenda line

      foreach item $originalList {

        if {[string equal “PROCEDURE/ADD…” $item]} {

           #if the addenda line is found set found variable to 1

           set foundAddenda 1

        }

      }

      #if the addenda flag has not been set

      if {[string equal $foundAddenda 0]} {

        set stopRequest 0

        #since there is no addenda only take up to electronic sig line

        foreach line $originalList {

           if {[string equal “(Electron…” $line} {

              set stopRequest 1

           } else {

           }

           if {[string equal $stopRequest 0]} {

              lappend obxList $line

           } else {

           }

        }

      } else {

        set obxList $originalList

      }

    • #70229
      Mark Perschbacher
      Participant

      Jason, I think I may have confused you.  There is data below HPV Hybrid that I don’t want to grab if Procedure is found.

      …..

      …..

      FINAL CYTOLOGIC DIAGNOSIS

      ……

      ……..

      ……..

      (Electronically Signed)

      ………..

      PROCEDURE/ADDENDA:

      ……..

      ………

      The HPV Hybrid

      ……

      ……

      ……

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

Forum Statistics

Registered Users
5,126
Forums
28
Topics
9,296
Replies
34,439
Topic Tags
287
Empty Topic Tags
10