Sisense Community logo
    • Community Feedback
    • Chapters
    • Events
    • Forums
      • Help and How To
      • Product Feedback Forum
      • Strategy & Use Cases
    • Blogs
    • KB Docs
      • KB Docs
      • Add-Ons & Plug-Ins
      • APIs
      • Best Practices
      • Blox
      • CDT
      • Cloud Managed Service
      • Data Models
      • Data Sources
      • Embedding Analytics
      • How-Tos & FAQs
      • Onboarding
      • PySisense
      • Security
      • Sisense Administration
      • Sisense Intelligence & AI
      • Troubleshooting
      • Widget & Dashboard Scripts
    • Support
    • Learning
      • Sisense Academy: Free Courses and Certifications
      • Official Developer Documentation
      • Official Product Documentation
      • Official Sisense Youtube Channel
      • Sisense Compose SDK Playground
    • Use Case Gallery
    All PostsDiscussionsBlogsIdeasQuestions
    Leaderboards
    •                    
    •                    
    •                    
    •                    
    •                    
    •                    
    •                    
    •                    
    •                    
    •                    
    •                    
    •                    
    •                    
    •                    
    •                    
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
    Discussions
    • Knowledge Base DocsChevronRightIcon
    • CDTChevronRightIcon
    Wildcard Filter For Comma Separated List Of Values
             
    You can easily create a wildcard filter that allows you to filter by a word or series of words on your chart using this post on Wildcard Filters. However, let's say you have a list of comma separated filter values that you'd like to filter on and it is too many to have to enter in one by one. With a find and replace tool (like this one) and a few lines of python we can filter by a given list of words easily. 
    First create a filter that "Allows users to enter values."
     
    Then use the find and replace tool to replace all commas with a dash - (this is because Sisense for Cloud Data Teams removes special characters from filter values but dashes do not get removed).
     
    Then include the filter in the select clause of your sql query with single quotes around it like below.
    select
      lower(first_name) ||' '|| lower(last_name) as name
      , '[wildcard_filter]' as filter
    from
      users
    Then in the python editor, you can use these 3 lines to manipulate the string of filter values, filter the results, and then remove the filter column that we added in the sql. 
    # SQL output is imported as a dataframe variable called 'df'
    import pandas as pd
    
    # replace the dashes with the regex pipe
    all_filters = df['filter'][0].replace('-', '|')
    
    # filter dataframe to only return results where the name matches the wildcard filter
    df = df[df['name'].str.contains(all_filters)]
    
    # drop the filter column to return desired output
    df.drop('filter', axis=1, inplace = True)
    
    periscope.table(df)
    Here is an example of the results: 
    intapiuser
    By
    intapiuser
    Posted 3 years ago
                                           
             
    0 comments

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
                   
                                                                                     
    •                                                              
    •                                                              
    •