Alteryx Designer Desktop Discussions

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

Filter on existing column-only one of the columns will be present.

KF
5 - Atom

Hello

I have input data in excel file. So the data can have either column A or column B but not both. How do I design the workflow that if column A present filter on that for string "ABC" and if column B present filter on that for string "DEF"?

 

In python I use try-catch in such cases.

 

Thanks!

4 REPLIES 4
kmedici
8 - Asteroid

Hi @KF 

 

Would you not just use a filter tool with syntax like the following:

 

Contains([column a],"ABC") OR Contains([column b],"DEF")

 

If I've missed the point then I'll need you to expand on your question, but based on what you've asked, the above should do the trick.


Cheers

Kris

 

 

atcodedog05
22 - Nova
22 - Nova

Hi @KF 

 

Here is how you can do it. You can have a header template which has all the columns. And use union to maintain all the columns to be present before data filtering. This way it doesnt cause execution error of missing columns.

Workflow:

atcodedog05_0-1632239951011.png

 

Hope this helps : )

KF
5 - Atom

Hi Kris

 

Thanks for the reply.

But if column B is not present in the input data it gives an error of unknown variable.

 

So if column A is present I want to the workflow to filter on that and when column A is absent then column B will be present, so in that case to filter on column B.

KF
5 - Atom

Thanks atcodedog. I was hoping instead of union with the headers if I could use filter or formula to do that. I have like 80+ headers and their names can vary slightly as well.

Labels