Tcl help

  • Creator
    Topic
  • #47840
    uma jandhyala
    Participant

      Can some one help with TCl I am trying to strip the values between the quotes .ForEx: “(PRE-POST PAIN SCALE)~&(__-__)(__-__)(__-__)(__-__)(__-__)”

      Thanks

    Viewing 8 reply threads
    • Author
      Replies
      • #56850
        Jay Yeiser
        Participant

          Use the “lindex” command to identify the string and then do the “regsub” command and replace the string with null (“”).

        • #56851
          uma jandhyala
          Participant

            Thanks for the reply but I did not had any luck . I am new to Tcl and not sure what I am doing

            if [cequal “RXE” $segtype]

            if {  [lindex $rxeflds 21] == “””} {

               

             regsub -all {“} $rxeflds (“”) rxeflds

            return “{CONTINUE $mh}”

            can someone pls tell me what I am doing wrong

            Thank you very much

          • #56852
            uma jandhyala
            Participant

              I am sorry I missied one line in my code

              if [cequal “RXE” $segtype] {  

              set rxeflds [split [lindex [lregexp $segments {^RXE}] 21] $sep];

              if {  [lindex $rxeflds 21] == “””} {

                 

               regsub -all {“} $rxeflds (“”) rxeflds

              Thanks

            • #56853
              Brian Goad
              Participant

                Can some one help with TCl I am trying to strip the values between the quotes .ForEx: “(PRE-POST PAIN SCALE)~&(__-__)(__-__)(__-__)(__-__)(__-__)”

                Thanks

                What are you wanting to “strip” I am not sure I understand what you are trying to accomplish.

                You can either reply or e-mail me.

                Brian Goad

                bgoad@mc.utmck.edu

              • #56854
                Linda Howell
                Participant

                  Hi Uma, we’re in TCL class and Greg suggested that we put a special character inbetween the comments that we want to keep and the comments that we want to get rid of.  In this example we used a : as the special character.

                  set commentList [split $xlateInVals :]

                  set xlateOutVals [lindex $commentList 0]

                  This is a TCL fragment so you would just put this in the translation on the appropriate COPY command.

                  See you next week,

                  Linda

                • #56855
                  uma jandhyala
                  Participant

                    Hi Linda,

                    That code did not work Are we missing something .

                    Thanks

                  • #56856
                    Karen Furman
                    Participant

                      Uma, Try removing the second group of tcl code (you have the code in there twice).  Then put in an echo of the xlateInVals in with the code we gave you.  This way when you run it in testing tool, you can see the value of the field….  Greg says the code should work and thinks it is a problem with the data in the field.

                      Karen

                    • #56857
                      Michael Hertel
                      Participant

                        Given:

                        “(PRE-POST PAIN SCALE)~&(__-__)(__-__)(__-__)(__-__)(__-__)”

                        Do you want to end up with:

                        (PRE-POST PAIN SCALE)~&(__-__)(__-__)(__-__)(__-__)(__-__)

                        or:

                        “”

                        Let us know

                      • #56858
                        Anonymous
                        Participant

                          Uma

                          I think you are trying to get this as follows:

                          Your input value is:

                          “(PRE-POST PAIN SCALE)~&(__-__)(__-__)(__-__)(__-__)(__-__)”

                          You want the output to be

                          (PRE-POST PAIN SCALE)

                          Of if so here is the code fragment. Based on this, build a pre-tcl proc:

                          hcitcl>set AA “(PRE-POST PAIN SCALE)~&(__-__)(__-__)(__-__)(__-__)(__-__)”

                          hcitcl>echo $AA

                          (PRE-POST PAIN SCALE)~&(__-__)(__-__)(__-__)(__-__)(__-__)

                          hcitcl>set BB [split $AA ~]

                          hcitcl>echo $BB

                          {(PRE-POST PAIN SCALE)} &(__-__)(__-__)(__-__)(__-__)(__-__)

                          hcitcl>set CC [lindex $BB 0]

                          hcitcl>set CC [lindex $BB 0]

                          hcitcl>echo $CC

                          (PRE-POST PAIN SCALE)

                          Let me know if this work out for you.

                          -Reggie-  8)

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