1 Reply Latest reply on Apr 4, 2011 10:05 AM by philmodjunk

    Using middle () to trim fed ex tracking number

    rmaltsberger

      Title

      Using middle () to trim fed ex tracking number

      Post

      I'd like to trim the number given when I scan a FedEx barcode from the scanned 32 digits down to the trackable 12.  The 12 digits being on the 17th number, thus I'll use (doesn't @ = one numerical digit?)

      Middle("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";17;12)

      I also want to base the trim upon whether or not another field is set on a value.  I don't want to trim USPS numbers, so, I only want to trim a 32 digit value when my category field is set to FedEx.

      So upon modification of my category, I'll run a script that

      If [database2::category="FedEx"]

      go to field [database2::serial number]

      if [database2::serial number="@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"]

      set field [database2::serial number=middle("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";17;12)

      end if

      end if

      Or how should this work?!


        • 1. Re: Using middle () to trim fed ex tracking number
          philmodjunk

          Wildcards like @ are only usuable to perform a find.

          Middle extracts a section of the text in the first parameter starting at the postion indicated in the second parameter and returns the number of characters indicated in the third character.

          Middle ( "123456789" ; 2 ;3 )

          Returns: 234

          That's the 3 characters from "123456789" starting with the 2nd character.

          So if you have scanned this data into a field named ScanField, a Middle function such as this:

          Middle ( ScanField ; 17 ; 12 )

          Will return up to 12 characters from ScanField, starting with the 17 character.

          Hint: whenever a function isn't working for you, look it up in FileMaker help where you can find explanations of each parameter and examples of how it might be used.