commands for pulling data out of a field

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf commands for pulling data out of a field

  • Creator
    Topic
  • #54022
    Robert Denny
    Participant

      I am building a proc that creates a DG1 segment from an NTE segment.

      On the 3 field we are getting string similar to this format.

      Select a diagnosis:->Atrial Fibrillation (427.31)

      I need to pull the 427.31 from between the parenthesis and drop into a variable and also the Atrial Fibrillation needs to be in another variable. Then they will be put back together in this format.

      I am told that the number between the parenthesis are the ICD-9 codes and the string between the -> and the ( is the description of the code.

      DG1|1|ICD-9-CM|427.31|ATRIAL FIBRILLATION|

      I could use some help on commands to pull the Numeric code and the string between the -> and (.

    Viewing 1 reply thread
    • Author
      Replies
      • #79901
        Jim Kosloskey
        Participant

          Robert,

          Probably more than one way to resolve this but here is one way I think would work (I have not tested this):

          Use split on the entire field splitting on > that should give you

          Select a diagnosis:-       and

          Atrial Fibrillation (427.31)

          In a list.

          Then split the second element [Atrial Fibrillation (427.31)] on ( that should give you:

          Atrial Fibrillation       and

          427.31)

          as a list.

          use string trim to trim the ) of the right hand side of the 427.31).

          I think that should give you everything you want – of course if they break the pattern you describe and anything is possible with text all bets are off.

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

        • #79902
          Robert Denny
          Participant

            Thanks Jim.

            Worked great. First time at trying to pull two variables out of string, that has one variable inside parenthsis and the other variable following the -> characters.

            The way I tried first only worked when the ICD code description were two words.

            The way you described worked for every test case.

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