4 Replies Latest reply on Dec 3, 2014 5:52 AM by AlexOrrow

    Copy specific text from Field

    AlexOrrow

      Title

      Copy specific text from Field

      Post

      Hi, I currently import file names as separate records. The filename is always the same format " xxxx_xxx_xxxx"

      I would like after importing a list of filenames to copy each string of the filename into separate fields on the same record.

      So filename 1618_D18_0010 would be copied into the the following fields:

      FieldJob: 1618

      FieldDisc: 18

      FieldNumber: 0010

       

      Is there a script that can do this please?

       

        • 1. Re: Copy specific text from Field
          philmodjunk

          You don't have to use a script. You can set up the three fields to auto-enter a portion of this text during the import if you enable auto-enter options. You can also do a replace field contents (if importing multiple image files) or Set Field (if inserting a single file)--either manually or via script immediately after import/insert. It's the same basic calculation either way:

          Job:

          GetValue ( Substitute ( FileNameFieldHere ; "_" ; ¶ ) ; 1 )

          Disc:

          GetasNumber ( GetValue ( Substitute ( FileNameFieldHere ; "_" ; ¶ ) ; 2 ) ) //GetasNumber removes the "D"

          Number:

          GetValue ( Substitute ( FileNameFieldHere ; "_" ; ¶ ) ; 3 )

          • 2. Re: Copy specific text from Field
            AlexOrrow

            Thank you very much this works just as I had hoped!

            Something I notice while using the GetasNumber ( GetValue ( Substitute ( FileNameFieldHere ; "_" ; ¶ ) ; 2 ) ) calc with another field  is that if the filename contains a preceding zero e.g. xxxx_xx_0120 the zero get omitted from the result. Is there a way to retain the zero? Many thanks

            • 3. Re: Copy specific text from Field
              philmodjunk

              Filter ( GetValue ( Substitute ( FileNameFieldHere ; "_" ; ¶ ) ; 2 ) ; "9876543210" )

              You can add other characters to the quoted string as needed.

              • 4. Re: Copy specific text from Field
                AlexOrrow

                Thank you very much Phil! It works perfectly!