Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Conditonal Filtering

sanketkatoch05
8 - Asteroid

I have a problem statement wherein I have an input file that changes daily and I need to filter a column(Subject) based on a condition that creates a table if value : 'English' is present in the column 'Subject' then Filters only on English else when value: 'English' is not present then it does not creates any table.

 

INPUT1 : 

Subject Marks
English10
English20
Maths30
English 20
Maths10

 

OUTPUT1 : 

Subject Marks
English10
English20
English20

 

INPUT2:

Subject Marks
Maths10
Maths20
Maths40
Maths 40
  

 

OUTPUT2: 

'No Records for Subject: English were found'

6 REPLIES 6
JosephSerpis
17 - Castor
17 - Castor

Hi @sanketkatoch05 can you use a filter tool for this with the Subject of english?

 

Filter_12072021.JPG

atcodedog05
22 - Nova
22 - Nova

Hi @sanketkatoch05 

 

Here is how you can do it. Hope you have version 2020.2 or later this uses data cleanse tool feature from that. If not let me know.

 

Case1: With

atcodedog05_0-1626088792367.png

 

Case2:

atcodedog05_1-1626088855208.png

 

1. Using filter tool to keep only English.

2. Using count records to get row count with English.

3. Using append tool to add count to the data.

4. Using formula tool to check if count>0 or not. If count=0 output comment if not output rows.

5. Data cleanse tool remove null columns. This is used to keep only needed columns.

 

This way we can simulate the required output.

 

Hope this helps : )

 

sanketkatoch05
8 - Asteroid

Hi, thank you for the replies. 

But in both the solutions, you guys are using 2 different inputs. My query was regarding only one input file because it is dynamic in nature. Sometimes it contains English sometimes it doesn't. 

I wanted to create a single table wherein if no English records are found the Table tool should show 'No Records for Subject: English was found' and if there are English records then it gives a table for it. 

atcodedog05
22 - Nova
22 - Nova

Hi @sanketkatoch05 

 

Its 2 usecases for 2 inputs scenarios. You just need only one workflow where input will be feeded in.

 

atcodedog05_0-1626093993845.png

 

Hope this helps : )

sanketkatoch05
8 - Asteroid

Thank you @atcodedog05 . 

 

This helps a lot. 🙂

atcodedog05
22 - Nova
22 - Nova

Hope this helps : ) @sanketkatoch05 

Labels