simple string range question

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf simple string range question

  • Creator
    Topic
  • #55024
    Kevin Crist
    Participant

      I am having issues with what I though would be something simple. I need to pull out the first character of a code in the OBR4 field.

      The value is L100.0050, L400.0625 and others.

      When I try to pull the first letter only wanting the “L” but I am getting everything up to the decimal point. So I am getting L100 , L400 .

      Below is my code. Any ideas?

      lassign $xlateInVals begChar

      set NewBegChar [string range $begChar 0 0]

      lappend xlateOutVals $NewBegChar

      is this wrong?

      thanks.

    Viewing 1 reply thread
    • Author
      Replies
      • #83826
        James Cobane
        Participant

          Kevin,

          Should xlateOutVals only be the first character, or are you truly trying to append the 1st character to the existing value?  If you only want the first character, then I think you need to:

          set xlateOutVals

            I believe xlateOutVals is normally already populated with xlateInVals, and lappend’ing to it would add the additional output value to xlateOutVals (assuming there is another output field listed to house it).  This is probably why you are still seeing the L100 (is the output field only 4 characters in length?)

            You should echo out xlateOutVals prior to executing your code to see what is there.

            Jim Cobane

            Henry Ford Health

        • #83827
          Kevin Crist
          Participant

            that loud thud you heard was my head hitting the desk. knew it was something simple.

            That worked great and makes sense.

            Thanks a bunch.

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