3 Replies Latest reply on May 5, 2015 1:19 PM by philmodjunk

    Parsing Text Serial Number



      Parsing Text Serial Number


      I have a serial number (text) field that has a Hyphen,  I'd like to parse all data to the right of the hyphen and place it into another field. In my current script I use SetField and specify the calculated value RightWords. When I run the script on a serial number, like WMX720-818 I get the value 720818 instead of 818. I thought the hyphen was looked at as a word separator. 

      Any suggestions?

        • 1. Re: Parsing Text Serial Number

          Hi Ricardo,

          I assume that your Serial-Number is of variable length!?

          One solution you might want to try Is:

          1. Get the Length of the serialnumber with the Length-Command (This will result to 10 in your example)
          3. Get the position of the hyphen with the position-command (this will result to 7 in your example)
          5. Extract the value to the right of the hyphen with: Character right("Serialnumber",Length minus Postion).Length minus postion will result to 3. Three Characters to the right="818"
          7. This method shoutd work regardless how many Characters there are before and after the hyphen.


          PS: I do have only the German enviroment and I hope iI did translate the Commands correctly.


          • 2. Re: Parsing Text Serial Number


            If you want to place an automatic calculation on the field the whole calculation should look as follows:

            ZeichenRechts ( "WMX720-818" ; Länge ( "WMX720-818" ) -Position ( "WMX720-818" ; "-" ; 1 ; 1 ))

            ZeichenRechts= Charactersright?

            Länge = Length?

            Position = Position?

            • 3. Re: Parsing Text Serial Number

              GetValue ( Substitute ( SerialNumberFieldHere ; "-" ; ¶ ) ; 2 )