3 Replies Latest reply on Feb 6, 2015 2:16 PM by philmodjunk

    Inserting Symbols in Text Field

    DylanPaschall

      Title

      Inserting Symbols in Text Field

      Post

      I have a field in my database that I would like to automatically add a : symbol after every 2 characters entered into the field. How do I go about setting that up? I have played around with the field and haven't had any luck. 

      Example: 

      What I enter: 0017F20C0698

      What is Displayed: 00:17:F2:0C:06:98

      -Thanks

       

        • 1. Re: Inserting Symbols in Text Field
          philmodjunk

          Is the number of characters entered (not counting the colons) always the same?

          If so:

          Let ( St = Substitute ( self ; ":" ; "" ) ; // remove any : characters entered by user
                   Left ( St ; 2 ) & ":" &
                   Middle ( St ; 3 ; 2 ) & ":" &
                   Middle ( St ; 5 ; 2 ) & ":" &
                   Middle ( St ; 7 ; 2 ) & ":" &
                   Middle ( St ; 9 ; 2 ) & ":" &
                   Middle ( St ; 9 ; 2 )
                ) // Let

          This can be set up as an auto-enter calculation if you clear the "do not replace existing value..." check box.

          If the number of characters can vary, a looping script or recursive calculation would be needed to adapt this to a varying length of characters.

          • 2. Re: Inserting Symbols in Text Field
            DylanPaschall

            Where do I paste this at? There will always be the same amount of Characters in the field. And would you also know how to do it for another field for an ip address as in putting the . between the numbers. Ex. 192.168.1.1

            Thanks for the help!!

             

            • 3. Re: Inserting Symbols in Text Field
              philmodjunk

              Find the field in Manage | database | fields

              Double click it

              Click the auto-enter tab

              Click the calculation button.

              Paste

              Click OK

              Click to clear the "do not replace existing value...." check box.

              Click OK to close dialogs until you are back to the main database window.

              Note: This will not modify existing data in any existing records. It will only affect what is in this field when you edit or enter data after making this change.

              For the IP address, I don't think this method will work unless you can guarantee that the number of digits between periods is always the same. If you can then you should be able to modify the expression that I have already posted to do what you need.