1 2 3 Previous Next 61 Replies Latest reply on Feb 10, 2012 1:35 PM by listen2earth

    How Do i GetWordNumber ( field )

    listen2earth

      Good day

       

      There's the function WordCount that returns the total number. But i just want the number of a selected word.

       

      Can someone write me custom function for:

      GetWordNumber (field)

       

      i am needing to return the numbers of selected words.

      Thank you

      r o b

        • 1. Re: How Do i GetWordNumber ( field )
          AlanStirling

          Hi Rob

           

          If I understand you correctly, the following formula should work …

           

          PatternCount(field;selectedword)

           

          Hope this helps - Alan Stirling, London UK.

          • 2. Re: How Do i GetWordNumber ( field )
            skywillmott

            Hi there,

             

            Based on the premise that words are defined by being separated by the space character, then the following should work, providing a word in the field is actually selected, otherwise it simply returns '1':

             

            PatternCount ( Left ( my_table::my_text ; Get ( ActiveSelectionStart ) ) ; " " ) + 1

             

            Sky.

            • 3. Re: How Do i GetWordNumber ( field )
              comment

              listen2earth wrote:

               

              i am needing to return the numbers of selected words. 

               

              The question is not quite clear, but I am guessing you mean =

               

              WordCount ( 
              Middle (  Get ( ActiveFieldContents ) ;  Get ( ActiveSelectionStart ) ;  Get ( ActiveSelectionSize ) )
              )
              

               

               

              Note that partially selected words are counted as words, too.

              • 4. Re: How Do i GetWordNumber ( field )
                skywillmott

                ... see attached file...

                • 5. Re: How Do i GetWordNumber ( field )
                  listen2earth

                  S K Y

                   

                   

                  what a beautiful name!!!

                   

                  Thanks !!    i see it not works,   if i have amidst my text ..  random space size, as    "YOU SEE"  clearly in this sentence. 

                   

                  otherwise beautifully simple.

                   

                   

                  ps.. also been beating my head many hours trying to arrive with these results BUT not actually select word with cursor but have the word i want, residing in a global field.

                   

                  HeartLand America

                  Wawaka Indiana

                   

                  r o b

                   

                          disabled War

                     Vet and Proud Of It

                   

                   

                  Structures from silence -- earths

                  dynamic airwave -- changes all

                  • 6. Re: How Do i GetWordNumber ( field )
                    comment

                    LOL, so we already have three different interpretations of the question.

                     

                     

                    BTW, the assumption that words are always separated by (single) spaces is unfounded. Why not use =

                     

                    WordCount ( Left ( my_table::my_text ; Get ( ActiveSelectionStart ) ) )
                    

                     

                    which has the added advantage of returning 0 when no active selection exists.

                    • 7. Re: How Do i GetWordNumber ( field )
                      listen2earth

                      Thank you!!

                       

                      That would be useful in some situations however now i am thinking for quickly attaining the number of each word amidst my text, is to simply use a global field called TextEditor and set my Text of interest into it, for displaying each word AND with its number attach to its beginning. From there i can start manipulating it.

                       

                      assuming unfortunately there's no other way except to loop it???

                       

                      i m sure it is a simple loop but my mind is on vacation when i should be.

                       

                      r o b

                       

                          

                       

                              disabled War

                         Vet and Proud Of It

                       

                       

                      Structures from silence -- earths

                      dynamic airwave -- changes all

                      • 8. Re: How Do i GetWordNumber ( field )
                        skywillmott

                        Ah yes, this is much better than what I put before....

                        • 9. Re: How Do i GetWordNumber ( field )
                          comment

                          listen2earth wrote:

                           

                          quickly attaining the number of each word amidst my text

                           

                           

                          I am afraid I still don't understand what you describe. Do you mean something like a frequency index? For example:

                           

                          Text:

                          Ulysses, Ulysses - Soaring through all the galaxies. In search of Earth, flying in to the night. Ulysses, Ulysses - Fighting evil and tyranny, with all his power, and with all of his might. Ulysses - no-one else can do the things you do. Ulysses - like a bolt of thunder from the blue. Ulysses - always fighting all the evil forces bringing peace and justice to all.

                           

                          Index:

                          Ulysses…7

                          soaring…1

                          through…1

                          all…5

                          ...

                          • 10. Re: How Do i GetWordNumber ( field )
                            beverly

                            r o b, are you trying to know the Nth word (position) of your global field in another text field (or variable)?

                             

                            Or are you trying to know how many times the global field contents occurs in the text field contents?

                             

                            Or something else? Can you provide an example of these two fields and what expected result you want?

                             

                            Thank you,

                            Beverly

                             

                            On 07 Feb 2012, at 8:38 AM, listen2earth wrote in whole or in part:

                             

                            created by listen2earth in Advanced Discussion - View the full discussion

                            Thank you!!

                             

                            That would be useful in some situations however now i am thinking for quickly attaining the number of each word amidst my text, is to simply use a global field called TextEditor and set my Text of interest into it, for displaying each word AND with its number attach to its beginning. From there i can start manipulating it.

                             

                            assuming unfortunately there's no other way except to loop it???

                             

                            i m sure it is a simple loop but my mind is on vacation when i should be.

                             

                            r o b

                             

                            • 11. Re: How Do i GetWordNumber ( field )
                              listen2earth

                              Y E S !!!!!!!!!!

                              H O W?????

                              Do you do that???????? And i like the definition yes it is pretty much a frequency thing!

                              r o b

                              • 12. Re: How Do i GetWordNumber ( field )
                                beverly

                                frequency! Ah!

                                Let's start by helping you understand some of the functions in Filemaker.

                                PatternCount(text; searchString)

                                http://fmhelp.filemaker.com/fmphelp_10/en/html/func_ref3.33.73.htm

                                or using your fields:

                                Patterncount ( yourTextfield; yourGlobalfield )

                                 

                                This will MATCH every occurence of 'yourGlobalfield' in the field 'yourTextfield'. This will MATCH every full word that is your global, this will MATCH every word that _contains_ your global, this will MATCH regardless of case.

                                 

                                So let's take an example:

                                global = "hat"

                                text = "This is the hat I want to wear. That is very important to me. Hats are my favorite accessory."

                                 

                                RESULT = 3 (MATCHING: 'hat', 'That', & "Hats")

                                 

                                Is that what you want? or do you want FULL words only?

                                 

                                Beverly

                                • 13. Re: How Do i GetWordNumber ( field )
                                  comment

                                  OK, can you explain why you need this? Have a look at this custom function:

                                  http://www.briandunning.com/cf/1027

                                   

                                  It does something very similar, albeit with values rather than with words. It would be much more difficult to do the same thing reliably with words, because there are many characters that can act as word-delimiters - while values are always return-separated.

                                  • 14. Re: How Do i GetWordNumber ( field )
                                    listen2earth

                                    T H A N K S!!!!!!!

                                     

                                     

                                    _i_ have been reviewing all content more closely !

                                     

                                     

                                    r o bfromHeartLand AmericaWawaka Indiana

                                    Homebound disabled war vetand proud of it

                                     

                                    Message was edited by: listen2earth

                                    1 2 3 Previous Next