1 2 Previous Next 21 Replies Latest reply on Nov 18, 2013 8:08 AM by bruns

    Highlight text

    bruns

      Title

      Highlight text

      Post

           I have 2 fields 1) lessons_learned_search 2) gkeyword (global)

           I type a word in gKeyword field(example "shoe) and it goes and searches the lessons_learned_search field (which is a large text field) .  I currently have the find working but would like to highlight the word in the large text field so it is easy to see.

           I have made an attempt but it is not hightlighting it, any help is appreciated.  I have enclosed a screenshot of my script.

            

           Thanks

      Capture.JPG

        • 1. Re: Highlight text
          philmodjunk

               Perform find and perform Find/Replace are two different script steps. You do not enter find mode before using perform find/replace.

               You could try using Perform Find to find the records with the specified text and then use:

               Perform Find/Replace [Recordables::gKeyword ; find next ]

               But this will only find the first instance of your keyword in the first record found and highlight it.

          • 2. Re: Highlight text
            bruns

                 Do you have any suggections for a better script, one that would highlight the word in gKeyword for all instances?  I tried your suggestion from above but still does not work.  Thanks

            • 3. Re: Highlight text
              philmodjunk

                   A calculation field, with certain limitations, could use the substitute function to mark all instances of the text in gKeyword. The main limitation is that substitute is case sensitive.

                   The following example shows the keywords styled in Bold face but you can also select other text styles and/or a text color to highlight the matches:

                   Substitute ( Recordables::lesson_learned_Search ;
                          [Upper ( Recordables::gKeyword ) ; TextStyleAdd ( Upper ( Recordables::gKeyword ) ; Bold ) ] ;
                          [Lower ( Recordables::gKeyword ) ; TextStyleAdd ( Lower ( Recordables::gKeyword ) ; Bold ) ] ;
                          [Proper ( Recordables::gKeyword ) ; TextStyleAdd ( Proper ( Recordables::gKeyword ) ; Bold ) ] ;
                          [Recordables::gKeyword  ; TextStyleAdd ( Recordables::gKeyword  ; Bold ) ] ;
                                     ) // Substitute

                   This "bolds" all instances of the text in gKeyword where the text is all upper case, all lower case, has the first letter capitalized (proper) or is capitalized exactly the way that the user entered the keyword.

                   If the user enters the text as "aPPle", an instance of the text that is capitalized like this: "applE" will not be shown in bold face.

              • 4. Re: Highlight text
                bruns

                     I am still learning this, do I make gKeyword a calc filed and add this substitute calc you did, or do I somehow add this to the script I started.  If I add this as a calc,

                     do I still need my script and if so to what point.  Thanks for your help.

                • 5. Re: Highlight text
                  philmodjunk

                       You do not change either existing field. Instead, you add a NEW field, define it as a field of type calculation and add it to your layout to show the contents of lesson_learned_Search, but with any text in it that matches the specified keyword shown in bold face or some other combination of text style and color.

                       What I do not know is whether lesson_learned_search is a text or a calculation field and I do not know if you need this field to be one that can be edited on this particular layout or not.

                  • 6. Re: Highlight text
                    bruns

                         The lesson_learned_search field is a text field.  No there would be no need for this field to be edited.  I made the 3rd field you suggested called keyword_results (calculation) and I am getting this error. 

                          

                         If I wanted to make the text highlighted yellow instead of Bold , would I replace the word bold with textcolor RGB(gkeyword_search; 255,10,10 )

                          

                         Does this script remove the highlight when I type a new word?

                          

                         Thanks for helping

                    • 7. Re: Highlight text
                      philmodjunk

                           remove the semi colon at the end of the previous line of text and it should work.

                           And the syntax for applying a text color would look like:

                           TextColor(Recordables::gKeyword;RGB(255;10;10))

                           You'd need that inside of each square bracketed term inside the substitute function.

                      • 8. Re: Highlight text
                        bruns

                             I am sorry, I am sure I am doing something wrong.  I have attatched 2 screen shots the last 3 fields are the fields I am working with in one screen shot and the other is the calc you did except I added the yellow highlight, hopefully I did that part right.  Anyway this is what it is doing.

                              

                             1) I still have the find script which is enclosed

                             2) when I type a word in gkeyword (Ivan) it does go and find the right records, but in the calc field you had me add ( it opens a different record and it did not bold so I changed it to the hightlight but does not highlight either, I think because it opened a record that did not have (Ivan) in it.

                             3) There is only one record with (Ivan in it)

                             I have enclosed several screen shots, please let me know if I can explain better.  Thanks

                        • 9. Re: Highlight text
                          bruns

                               another image

                          • 10. Re: Highlight text
                            bruns

                                 another

                            • 11. Re: Highlight text
                              bruns

                                   another

                              • 12. Re: Highlight text
                                bruns

                                     last image

                                • 13. Re: Highlight text
                                  philmodjunk

                                       The calculation field should not have global storage specified. Remove that storage option and the calculation you've shown in your post should BOLD the keyword text for the correct record. (Your posted calculation doesn't show the modifications needed to change the text color.)

                                  • 14. Re: Highlight text
                                    bruns

                                         I took the global off and now it finds and shows the right record.  Here is the calc for the highlight.

                                    1 2 Previous Next