Need to remove leading character

Clovertech Forums Cloverleaf Need to remove leading character

  • Creator
    Topic
  • #120809
    Abhishek
    Participant

      Hi all,

      I am looking for some help to remove the character “A” which is populating in PID-3.1 as the leading character. Eg: for value A1234, expected 1234

      Can someone help with the correct TCL scrip/Xlate function etc ?

       

      Thanks

      AJ

    Viewing 5 reply threads
    • Author
      Replies
      • #120810
        Travis Fulk
        Participant

          AJ, if the leading character will always be “A”, maybe go with xlateStrTrimLeft A OR if the leading character is not constant then maybe xlateStrSubstring 1 end.

          Travis

        • #120811
          Abhishek
          Participant

            Hi Travis,

            I am getting TCL callout error while using this line of code in the Xlate either in pre proc or post proc.

            I am new to cloverleaf and dont understand this completely. Can you assist where I should use the code

            xlateStrTrimLeft A

            xlateStrSubstring 1 end

             

            Thanks

            AJ

          • #120812
            Travis Fulk
            Participant

              AJ – screenshots attached.

              Attachments:
              You must be logged in to view attached files.
            • #120815
              Jim Kosloskey
              Participant

                What release of Cloverleaf?

                If you are prior to 6.0 the STRING Action is not available.

                But if a later release, the STRING is an Action you select in the Xlate just like COPY or BULKCOPY or IF, etc. Then there is a pull down menu for the function for the STRING Action you want to use select the appropriate function and hover over it and a usage tip will appear, then double click on the function and a prototype will appear.

                I have a STRING Action Treatise I prepared which is available if you email me. It goes over all of the known STRING Action functions, what they do, and how to activate them. I also provide a sample Xlate with each of the functions being used so that you can see actual usage. If you want it, I can even include a modification of one function that allows it to actually be used in an Xlate (the released one can only be used with another function) and perhaps an additional function or two I have created. Just email me if you want that material.

                Jim

                email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

              • #120816
                Paul Bishop
                Participant

                  As Jim says, if you are prior to 6.0, the translate string action isn’t available.  This code snippet will do the trick using the copy action in a translate and will remove the first character regardless of what it is.  If your original value happens to be only one character long, it will return a null value.

                  lassign $xlateInVals in_val
                  set out_val [string range $in_val 1 end]
                  set xlateOutVals

                    Source will be the field the data is coming from, and Destination will be where you want it to go.

                    Paul Bishop
                    Carle Foundation Hospital
                    Urbana, IL

                  1. #120817
                    Abhishek
                    Participant

                      This worked, Thanks a lot Travis !

                      -AJ

                  Viewing 5 reply threads
                  • You must be logged in to reply to this topic.