This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Very new to Alteryx so patience is appreciated. What I am trying to accomplish is to allow a user to enter a set of words then filter a separate set of input data by those strings. For example - if one of the fields was names. I would like to allow the user to input Jack,Jim,Jess,Jane and have the output be filtered for only those names. I realize the below is far from working but just wanted to depict what I am trying to get at.
Create a Text input with a placeholder set of names, then update this list from the Text box and Action tool. Convert the comma separated list to rows and use a join tool to grab the selected names from your input file.
Did you choose the multi-line feature on the text box tool? And is the connection from the action tool to the filter tool named #1?
The filter tool, on the canvas, is just a place holder. You could put anything in there you want, or even leave it blank. For simplicity purposes, and so I don't have to look at a red exclamation point as I build, I put an "always true" statement like "1==1".
The action tool takes what's coming in and creates a formula for the filter tool to use. When you use the multi-line option on the text box, whatever people enter will come in like this:
What you want to do is create a formula to stick in your filter tool.
So you say okay, the formula to stick on the filter needs to be [car name] IN ("this","is","my","example")
So we need to take:
And turn it into [car name] IN ("this","is","my","example")
Now, in the action tool, you're telling it to replace "1==1". So you need to wrap what you're replacing it with in quotes.
The first step is to take
And make it look like ("this","is","my","example").
So you want to say "hey, start with the first word, and replace the carriage return with a comma, and oh yea, put quotes around each word", and then put what you come up with by doing that in parenthesis. And then toss on a [car name] IN at the beginning. To do this you need to use REGEX. Carriage return in REGEX language is \n. You also have to be careful with your quotes to make sure they get in there correctly.
So the formula for the action tool is: '[car name] IN ("'+REGEX_Replace([#1],'\n','","')+'")'
Make use of the debug feature - do CTL+ALT+D to open the interface designer, on the left, click the wand, enter some dummy values, then on the right click debug, and a module will open with your values inserted into the filter tool. You can see there is any tweaks need to be made.
Unfortunately the community doesn't appear to allow me to post YXWZs, so I can't post a sample one.
@mbarone, if you export your YXWZ as a package from Options -> Export Workflow, you'll be able to attach it to your post. I was wondering how you'd pass multi-line text into an argument of a filter tool with and action tool.