LOADING

Type to search

Design Patterns

Alteryx Design Pattern: Using Data to Create a WHERE Clause or IN Statement

Use Case:

You have a long list of items that you want to filter your SQL query down to for better performance. It can be difficult and painful to have to type many values. Fortunately you can use this solution to speed that up. The added benefit is that you can use this to create a value list for an IN statement in the formula tool as well. A note of caution here is that sometimes this problem can be better or more easily solved by using a Join to do the filtering, just depends on a case by case basis.

solution2.png

Steps:

  1. Input Data
  2. Group By List Field (To get unique values)
  3. Summarize tool with Concatenate
  4. Place “Where” or IN” in Start box of Concatenate

NOTE: Make sure you look at your data and if there are values with a single quote that you use double quotes and vice versa

Tags:

You Might also Like

Leave a Comment

Your email address will not be published. Required fields are marked *