Alteryx Designer Desktop Discussions

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

Batch Macro to filter using a checkbox with values from a field

vdix
7 - Meteor

I am trying to create a macro that takes values from a field in the table, and shows that list to the user to input from and filter.

5 REPLIES 5
Kakuffo
Alteryx
Alteryx

hi @vdix do you mean macro that allows the user to select from a list of options within a particular field to then apply to a filter?

vdix
7 - Meteor

yes that is right, i am trying to create an analytic app that allows the user to pick the file (within folders titled month name) so i added the corresponding month name to the file's record. i am unable to figure out how to configure the List box tool and also how to output it to pass it down to a dynamic input tool... @kakuffo

DataNath
17 - Castor
17 - Castor

Hey @vdix, unless I'm misunderstanding the request, it sounds like you want to create an App here instead of a macro, as you require User Input. Whilst learning Alteryx, I built a simple app that does what you seem to be asking - creating a list of unique values in a field that is then presented to the end user to filter on, with the option to select multiple from a List Box. In my example, I just want to be able to filter the list of coffee shops by market:

 

To create the list, group by the target field twice - I tend to just call them Name/Value for ease:

DataNath_0-1661356581158.png

 

Next step is to Cross-Tab the data so that you just end up with a single row of data, with each cell matching it's header:

DataNath_1-1661356620618.png

 

Now, as you want to be able to select multiple, this method relies on you using a filter with the 'IN' function, rather than Contains() or =.

DataNath_2-1661356705772.png

 

When it comes to configuring the List Box tool, you'll want to select Generate Custom List and leave the 3 boxes as is. All this is doing is adding the relevant punctuation before/after/between each selection, as when you run the app with multiple markets selected, you'll end up with an expression like [Market] IN ('North', 'South', 'West') under the hood, where Alteryx has automatically placed ',' between selections, and ' at the start and end.

DataNath_3-1661356823821.png

 

In your Action tool configuration, you're going to want to replace the expression value and you need to tick to Replace a specific string, as you only want your selection to effect the part of the expression within the brackets (which in this case is 'South').

DataNath_4-1661356909770.png


When you come to Run as Analytical App (the magic wand icon next to 'Run'), your end user will then be presented with the list of all possible markets (or whichever field you want them to filter on).

DataNath_5-1661356987659.png

 

And in the resulting document, you'll see that there are only records relating to the selected values (South & East in this case).

DataNath_6-1661357057093.png

 

If we open the app in Debug mode, using the same selections, we can see what I was talking about earlier, where Alteryx has automatically populated the 'IN' expression with the selected values, with the correct punctuation around these to build the filter expression correctly.

DataNath_7-1661357152852.png

 

I've attached my demonstration app for you to play with/reverse engineer. Hope this helps but do let us know if not!

DataNath
17 - Castor
17 - Castor

Sorry @vdix, was typing out my reply when you mentioned this being used to select files. If that's your use case, could you not just use a File Browse tool? This prompts the user to navigate to and select a file (shown below), which you can then use to update a Data Input tool.

 

DataNath_0-1661357844620.png

vdix
7 - Meteor

hi,

 

i'm actually trying to use it with a directory tool to filter out the filepaths based on the list box conditions, then pass it to a dynamic input tool to merge those files.

so i want to be able to select multiple files which are in month wise folders, so there is a file inside a January folder and so on, so i want to show that list of months to filter the filepaths selected then output it to the dynamic input tool

how can i go about achieving this?

Labels
Top Solution Authors