We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Custom Filter Expression

kas
8 - Asteroid

Hello!

 

I am unsure how to write a Custom Filter expression for the following scenario - I will be connecting a 'Text' Interface tool so the end user can type in the specific answer they are looking for.

 

There will be a field with policy numbers, and the default for the filter should be "all", unless they enter a specific number in the prompt within the Text interface. 

 

So the custom filter would be something like:

 if [Policy Number] = '1234567' then '1234567' else [Policy Number] endif

 

Then I could use the Text box interface tool and if left blank, all policies would come through, and if a policy number is entered, only that policy number would come through.

 

I've attached a mini workflow for the scenario...any input is greatly appreciated!

 

Kim

4 REPLIES 4
abacon
12 - Quasar

@kas I have detailed the steps below.

1. You need to use a formula within the action tool you have connected to the filter.

2. I changed the tool that gets updated from the filter itself to a formula tool to create a variable.

3. In the filter tool, if the previously created variable doesn't change, it won't filter anything out - if it includes a value passed in, it will filter to the desired policy number.

 

Bacon

 

image.pngimage.pngimage.png

Gaurav_Dhama_
12 - Quasar

You can update the filter condition with anything and add a action tool with below config

 

if isnull([#1]) then ‘true’ else “[Policy Number] =‘“+ [#1] +”’” endif

 

what this will do is, if you don’t have an input, it will just pass ‘true’ and everything will pass, else it will replace the filter condition with the else part.
I am writing out of memory, so make any syntax correction if required.

kas
8 - Asteroid

@abacon 

 

This worked perfectly...thank you!!

abacon
12 - Quasar

@kas Love it! Glad it worked for you.

 

Bacon

Labels
Top Solution Authors