5 Replies Latest reply: May 15, 2014 9:57 AM by Tom4620 _ RSS

    Find the Numeric?

    Tom4620 _

      Hi

       

      How do I find the numeric in a character string:

       

       

      SPYROFLEX STERILE BLISTER DRESSING PK 5 3

      SPYROFLEX STERILE ABRASION DRESSING PK 3 10

      SPENCO CUT CONTROL DRESSINGS 2X3         13

       

      The numeric on the end floats and is either one or two digits. I have tried STRIP ,LEFT and RIGHT SPLIT with little luck. This report is from a PDF using V8 PRO.

        • Find the Numeric?
          Grant Perkins

          Hi Tom,

           

          Sounds like you want the last numeric on the string only, so I would use RSPLIT with SPACE as the separator BUT be aware that you field may have trailing spaces after the last numeric which might confuse things.

           

          RSPLIT(RTRIM(),2," ",1)

           

          should do it  - but I am always ready to be proven wrong!

           

          If you need to split into 3 sections you may also have to deal with multiple spaces separating the various parts of the field(s).

           

          In that case you may as well consider using the New-to-Version-8 INTRIM function which will probably give you all you need in one pass unless retaining certain spacing is critical for you.

           

          All this assumes that there is no way of getting the field separation directly out of the PDF interpretation. Nasty things, PDFs, sometimes! If itt's tricky have you looked at the 8.01 release to see if that helps?

           

          Good luck. Do let us know how you get on.

           

          Grant

          • Find the Numeric?
            Bruce _

            Tom

             

            I fooled around with a floating trap "nBn". (numeric, blank numeric)

             

            As this is not a large sample I cannot tell if this would work for everything. I assumed that you always have a number, then a space then another number. With this I was able to pick off the last set of numbers (3,10 13)

             

            Grant's answer is fine also, it will depend on how the report is layed out. Were mine will fail if you have a line with description, then qty (but no unit size in between.

            • Find the Numeric?
              Mike Urbonas

              Bruce, what about the following use of STRIP, LTRIM and RSPLIT:

               

              RSPLIT(

              LTRIM(

              STRIP(fieldname,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")),

              " ",2)

               

              STRIP eliminates the alpha values, LTRIM removes only the leading spaces, to the immediate left of the field.

               

              The formula thus far will have the following values from your example lines:

               

              5 3

              3 10

              23 13

               

              and the RSPLIT grabs the numeric value to the right of the space.

               

              If there is no numeric value at the end of a line, the formula should yield either a blank value.

              • Find the Numeric?
                Tom4620 _

                Sorry for my slow response, I was away yesterday.

                 

                The problem is that sometimes there is a space, sometimes there isn't between the right number and the left description. To complicate things more, the description sometimes ends with a number.

                 

                What I am going to try today is to try an append query for the shifted ones. The sample for some reason doesn't show acturately. Most of the time the right numbers(class) are lined up. Every once in a while they shift closer to the description. It was explain to me that during PDF translation it looks for spaces between words when translating. What is weird is the original PDF might show 20 characters for a description but the translation will show 25, hence the displacement. I'll post my results.

                • Find the Numeric?
                  Tom4620 _

                  You won't believe this. I was trying to strip away the right hand side and having problems with spaces, using trim. So,I went into the field properties and changed the ALIGNMENT to right, and all of the numbers aligned up perfectly!!!I mean I had some descriptions ending in numbers and they stayed with the description!!

                   

                  Sometimes the simplest things.....