0

When search for contains, how to specify?

Just say I have a dimension, "Model" and within Model there is an element "THIS IS AN EXAMPLE". I want to be able to search for "IS" without "THIS" being shown as a result. Now, in google, for example, I'd search for "is". How do I do that in PA?

5 replies

null
    • VP Product Management
    • Ian_Macdonald
    • 3 days ago
    • Reported - view

    Hi 

    If you're using the quick search bar in the element tree, put * in front of the string you are looking for:

    If you want more advance search options, select the Member Search option from the search drop down or from the menu ribbon:

    See Help for more details.

    Hope that helps.

    Ian

    • VP Product Management
    • Ian_Macdonald
    • 3 days ago
    • Reported - view

    hi 

    Reread your post properly, lol.

    In this instance you can use * is to find the string " is" with the leading space. 

    As far as I am aware there is no equivalent to the "is" of Google search in member search.

    Hope that helps.

    Ian

      • Ricky_Melamed
      • 3 days ago
      • Reported - view

       

       

      This is how I am going about this. I've used the @CONTAINS filter. What I want to see is results where only "-SP" However, "-spacers" is one of the results, which I don't want. I want only the results that are an exact match.

    • VP Product Management
    • Ian_Macdonald
    • 2 days ago
    • Reported - view

    Hi 

    OK, so you want your search string to only match whole words, i.e. a string bounded by non a-z and A-Z characters.

    Pyramid supports the REGEX character search masking through the FindByPattern() function. A bit of judicious Googling (I'm no REGEX expert!) turns up a REGEX mask that will return matches of a string where that string is only a whole word. Using your first example, that equates to (?:^|\W)is(?:$|\W).

    We can create a measure which will examine each of the row elements caption and return a 1 if it contains the word "is" but will return 0 if it contains "This". 

    We can also use a global parameter so that you can enter and search on any whole word.

    Set up the parameter to allow free text input with no validation (you want to be able to enter "-")

    Then create a Measure that returns 0 if there is no match and 1 if there is a match. We put the user entered value in the parameter in the REGEX mask. Green rectangles are the start and end of the REGEX mask, the purple rectangle the text parameter containing the string to search for. the "+" operator in this case concatenates the strings together. The string to search is the [First Name].currentmember.caption, i.e. the name of the member in each row.

    The code is:

    If(FindByPattern([Customers].[First Name].currentmember.caption,"(?:^|\W)" + [global].#[34bd1572-8ca3-4f14-bebe-f9b2d9307851] + "(?:$|\W)")="", 0, 1)

    Creating a test grid:

    If course, the Find by Pattern measure can be filtered in the background, it doesn't need to be in the grid. So filtering to only show Find By Pattern values greater than 0 gives us the search result we want.

    If you wanted to get really fancy you could test the start and end of the input string and only apply the FindByPattern test if the string started and ended with  a double quote, like "is". Otherwise apply  a Contains search, or a StartsWith search.  You could build up a sophisticated search capability in this way under your control.

    Hope that helps.

    Ian

      • Ricky_Melamed
      • 2 days ago
      • Reported - view

       this is impressive. Thanks so much! Time to see if I can replicate this....

Content aside

  • Status Answered
  • 2 days agoLast active
  • 5Replies
  • 32Views
  • 2 Following