ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now
2 Day Countdown - The Alteryx Community will be temporarily unavailable for a few hours due to scheduled maintenance starting on Thursday, April 22nd at 5pm MDT. Please plan accordingly.

Alteryx Designer Discussions

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

How to create dynamic filter using data in my column

Edgar_Ryan_C
6 - Meteoroid

Hi Community,

 

I have a data and I want to filter column A (Province) and set individual output files per province, without using multiple filter tools. Is there a way to put this into a macro function?

 

ProvinceProd CodeQty
AlbertaAA100
AlbertaAB200
AlbertaAC300
AlbertaAA400
AlbertaAD500
AlbertaAA600
AlbertaAA700
British ColumbiaAA100
British ColumbiaEG200
British ColumbiaIA300
British ColumbiaBP400
British ColumbiaBP500
British ColumbiaBP600
SaskatchewanWD100
SaskatchewanWD200
SaskatchewanWD300
SaskatchewanWD400
OntarioBA100
OntarioBA200
OntarioBA300
OntarioBA400
OntarioBA500
OntarioBA600

Edgar_Ryan_C_0-1614615874327.png

 

JoshuaGostick
11 - Bolide

Hi @Edgar_Ryan_C,

 

You can create multiple out files based on the value under Province using a single Output tool. If you select Take File/Table Name From Field as shown below, you will be able to create a unique Output for each unique value for Province. Each output will be filtered to that specific Province.

 

Output Tool.PNG

 

Let me know if you have any questions or issues with this.

 

Thanks,

Josh

CharlieS
17 - Castor
17 - Castor

Hi @Edgar_Ryan_C 

 

To write an output for each Province value, a macro is not necessary, nor is a tool for each unique value. What I recommend is using a Formula tool to write the various output file names as a new field and have a single Output tool write all those files. The Output tool configuration gives you the option to "Take File/Table Name from Field" which can be set to a field with multiple values.

 

20210301-ProvinceOutput.JPG

 

Check out the attached workflow that writes a uniquely named .yxdb file for each value in the [Province] field and let me know if you have any questions.

KP_DML
8 - Asteroid

As @JoshuaGostick  said, you can have the Output Tool do the work for you. Workflow attached.

 

 

Edgar_Ryan_C
6 - Meteoroid

Thanks everyone! Works great for me. @JoshuaGostick @KP_DML @CharlieS 

Labels