2 Replies Latest reply on Nov 12, 2015 10:40 AM by Kris Erickson

    Color the word used in a wildcard filter

    giuliano janson

      I have some text data. I'm using a wildcard filter to allow the user to filter on any specific word they want.

      Once they choose a word, say "home", I'd like the returned data to diplay the entire text, but also have the word "home" highlighted (say, yellow background.

      I.e.:

       

      I live in a beautiful home in Seattle.

      There is no place like home.

      My site home page is now finished.

        • 1. Re: Color the word used in a wildcard filter
          Chloe Jensen

          I've done something similar to this in the past, but it required a parameter instead of a wildcard search. And I wasn't able to highlight the word, but I was able to format the word differently (different color, bold, larger size, etc.). You create a string parameter that triggers a calculated field to see if the text CONTAINS() the parameter text. This field will become your filter. You then have to use FIND(), LEFT(), and RIGHT() formulas to separate your text into two separate fields: one for all characters before the word in the parameter, and one for all characters after. Then use those two fields with your parameter side by side in your label. It should look something like this:

           

          [Left Trunc String][Search Term.Param][Right Trunc String]

           

          Because they're separate fields your can format each individually. I would share the calculations, but this was work I did at another job and no longer have access to. Hope that helps.

          • 2. Re: Color the word used in a wildcard filter
            Kris Erickson

            If we used the len() function so find the size of the thing we searched for.  Using this formula replace(SPACE([length of search term])," ","█")  Then we could backfill the searched portion with Mr. Blocky "█" color it's portion of the text yellow, and then maybe do a dual axis.

             

            However this way we'd be required to use a mono-spaced font such and Consolas.

            https://public.tableau.com/views/Demonym/HighLight?:embed=y&:display_count=yes&:showTabs=y

            Block_Highlight.PNG