5 Replies Latest reply on Jul 1, 2014 2:02 AM by itraining

    WordCount function and text field with autoenter Get(UUID) returns result of 3

    itraining

      Hi everyone

       

      In a new database I am finally making the switch from ID to UUID for the primary and foreign key fields. So it is out with the numerical autoenter serial number ID fields and in with text fields populated with the Get(UUID) function. Last year my very first attempt to populate a UUID field resulted in duplicate values and that scared me off the idea for a while. See February 2013 post below:

      https://fmdev.filemaker.com/thread/69217

       

      Question:

      Why does the WordCount function return 3 when used on a text field populated with the Get(UUID) function?

       

      Background:

      Please view the attached screenshots for more information

      The text field is populated with an autoenter Get(UUID) which returned E4D9F1B6-6133-4633-AEE0-D7B5D3F8E44D.

      Using the WordCount() function returned a result of 3 words but I was expecting a result of 5 words.

       

      The FileMaker help web page http://www.filemaker.com/help/11/fmp/html/func_ref3.33.89.html states:

      "The ampersand and hyphen characters identify the beginning of a new word."


      Some additional PatternCount(), Position() and Code() functions identified the separators as hyphens with Code() = 45.

      The calculation to generate the feedback in the dialog box is below:

       

      Let (

       

      [

      UUID = Observation::Observation_UUID ;

      Hyphen = "-" ;

      HyphenCount = PatternCount ( UUID ; Hyphen ) ;

      Posn1 = Position ( UUID ; Hyphen ; 1 ; 1 ) ;

      Code1 = Code ( Middle ( UUID ; Posn1 ; 1 ) ) ;

      Posn2 = Position ( UUID ; Hyphen ; 1 ; 2 ) ;

      Code2 = Code ( Middle ( UUID ; Posn2 ; 1 ) ) ;

      Posn3 = Position ( UUID ; Hyphen ; 1 ; 3 ) ;

      Code3 = Code ( Middle ( UUID ; Posn3 ; 1 ) ) ;

      Posn4 = Position ( UUID ; Hyphen ; 1 ; 4 ) ;

      Code4 = Code ( Middle ( UUID ; Posn4 ; 1 ) )

      ]

       

      ;

       

      "Word Count = " & WordCount ( UUID ) & ¶ &

      "Hyphen Count = " & HyphenCount & ¶ & ¶ &

      "Hyphen 1:" & ¶ &

      "Position = " & Posn1 & " Code = " & Code1 & ¶ &

      "Hyphen 2:" & ¶ &

      "Position = " & Posn2 & " Code = " & Code2 & ¶ &

      "Hyphen 3:" & ¶ &

      "Position = " & Posn3 & " Code = " & Code3 & ¶ &

      "Hyphen 4:" & ¶ &

      "Position = " & Posn4 & " Code = " & Code4 & ¶

       

      )

       

       

       

       

      Any help greatly appreciated.

      Thanks in advance.

       

       

      Michael Richards

      Brisbane (Australia)

        • 1. Re: WordCount function and text field with autoenter Get(UUID) returns result of 3

          Michael ,

           

          Apart from the fact that I don't see any use in splitting up a UUID, the FileMaker Help is correct:

          Words start with letters, not (negative) numbers.

           

          If you really want to do this, use

               wc = WordCount ( Substitute ( uid ; "-" ; " ") )

          or

               x = List ( WordCount ( Substitute ( uid ; "-" ; " ") ) )

           

          Winfried

           

           

           

          --

          Huslik Verlag GmbH • Bgm.-Widmeier-Str. 42 • 86179 Augsburg, DE

          CEO Winfried Huslik - HRB Augsburg 12386 -  VAT-Id. DE127485099

          Phone +49 821 565606, Fax +49 821 565001, Email info@fmdiff.com

          Verify your FileMaker Pro files with FMDiff - http://fmdiff.com

          FileMaker Developer Conference July 28-31 2014 • San Antonio TX

          Visit my Session on Thu, July 31, 2:00pm-3:15pm, room Perwinkle

          Linkedin: http://de.linkedin.com/pub/winfried-huslik/2/505/1a1/

          • 2. Re: WordCount function and text field with autoenter Get(UUID) returns result of 3
            user19752

            You can see what is a word by right clicking the field and select

            ”Insert From Index”

            1 of 1 people found this helpful
            • 3. Re: WordCount function and text field with autoenter Get(UUID) returns result of 3
              Malcolm

              Can you explain WordCount's output using these results?

               

              Let( uuid = Get(UUID); list( uuid; wordcount(uuid) ))

               

              DDAA3740-2893-42B2-8FCA-469319AD4317

              2

              757729F7-1DBB-44B3-B518-F8D6A4FD99E2

              4

              1A3CF665-6203-4626-9AA9-045040F667B9

              1

              378D8E6F-2726-4225-8E2C-FC1995E782AA

              3

              C4C9E337-D9BB-4C52-AB99-0D4A8B2A857B

              4

              B0BF4D7B-2C05-43B3-A1AA-0159A3B7F620

              4

              1 of 1 people found this helpful
              • 4. Re: WordCount function and text field with autoenter Get(UUID) returns result of 3
                itraining

                Thanks Winfried, User19752 and Malcolm.

                 

                @Winfried

                I was not aware the WordCount function interpreted the hyphen as a negative number or a hyphen depending upon the next character.

                Don't worry I don't want to split it the UUID up, I was just curious about the calculation result.

                 

                @User19752

                Yep I should have tried Insert From Index to troubleshoot further in the first instance.

                 

                @Malcolm

                I was OK until you posted your list of results, Now I am slightly confused again.

                The hyphen as a negative seems to hold but it depends on the combination of numbers/letters following the initial hyphenNumber or hyphenLetter.

                 

                Thanks again.

                 

                 

                Michael Richards

                Brisbane (Australia)

                • 5. Re: WordCount function and text field with autoenter Get(UUID) returns result of 3
                  itraining

                  Found the help page about FMP and its word separators:

                  http://help.filemaker.com/app/answers/detail/a_id/3440/~/word-separators-in-filemaker-pro

                   

                  Subtle but in FileMaker Pro 7 and later:

                  the hyphen, colon, and forward slash are treated as word separators

                  unless both characters adjacent to the separator are numerals.

                   

                   

                   

                  FileMaker Pro recognizes the following characters (and others) as word separators when working with the functions WordCount, RightWords, LeftWords, and MiddleWords:

                  space ! @ # $ % ^ & * ( ) _ + = { } [ ] | \ : ; " ' < > ? / * ~

                  The following characters (and others) do not act as word separators:

                  0 1 2 3 4 5 6 7 8 9 Ï a b c, etc. A B C, et.c

                  Note:

                  The character ` acts as a word separator on the Macintosh but not in Windows.

                  In FileMaker Pro 6 and earlier the hyphen was treated as a word separator if a character adjacent to the hyphen was a numeral.

                  In FileMaker Pro 7 and later the hyphen, colon, and forward slash are treated as word separators unless both characters adjacent to the separator are numerals.

                  A single quote will not act as a word separator when alpha characters appear on both sides of the single-quote.  If a numeric character appears on either side of the single-quote, then the single-quote would act as a word separator.  For example, "John's" would be considered one word, while 1's, 1'2, and John'2 would all be considered two words.