trimming a subfield

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf trimming a subfield

  • Creator
    Topic
  • #51917
    Kevin Crist
    Participant

      i have a subfield that sometimes exceeds the app limit of 15 characters, how would i trim off the right side if its > 15?

      for example:

      EMERGENCY DEPT VISIT to EMERGENCY DEPT

      Thanks.

    Viewing 7 reply threads
    • Author
      Replies
      • #72266
        Tom Rioux
        Participant

          If all you want is the first 15 characters, regardless, then just do a  string range:

          set var “EMERGENCY DEPT VISIT”

          set var [string trimright [string range $var 0 14]]

          I added the the string trimright to get rid of any spaces that may result from the string range (as would be the case here).

          Hope this helps…

          Tom

        • #72267
          Kevin Crist
          Participant

            Thanks Tom, works great. i have one question though for clarity…the string trimright you mentioned does that stop it at the space, for example when i tested:

            EMERGENCY DEPT VISIT – i got EMERGENCY

            THER/PROPH/DIAG INJ, IV PUSH – i got THER/PROPH/DIAG

            CESAREAN SECTION NOS – i got CESAREAN

          • #72268
            Jim Kosloskey
            Participant

              Kevin,

              Make sure there is no other white space in the text (such as tabs or newlines) that can cause trimright to trim unless you specify the character set you want trimmed.

              I usually specify ” ” if I only want to trim spaces.

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

            • #72269
              Kevin Crist
              Participant

                i think we would prefer to be able to have the spaces in there. We have some procedures that have names:

                THER ULT HEAD & NECK VES

                THER ULTRASOUND OF HEART

                THER ULT PERIPHERAL VES

                I am worried if i trim it to first space  and get THER, i am not sure that is  enough description for the docs.

              • #72270
                Jim Kosloskey
                Participant

                  Kevin,

                  In many cases the receiving system does want to see the trailing spaces as that may mean something to them. So if tht is what you think will work best just use the string range.

                  However the trimright should not remove any trailing non white space characters as you appear to be experiencing.

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

                • #72271
                  Tom Rioux
                  Participant

                    Oops…sorry about that……Monday on a Friday type of day!

                  • #72272
                    Kevin Crist
                    Participant

                      thats no prob. know the feeling all too well. got to work, thanks tom, jim.

                    • #72273
                      Scott Folley
                      Participant

                        Are you doing this in the translate?  The only reason that I could see those commands doing what you are referring to would be if you were doing this on a value in the translate that was internally being treated as a list.  In that case you would want to grab the value as a list so that it doesn’t split on the whitespace when accessed.

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