Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.
Free Trial

Alteryx Designer Desktop Discussions

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

Listbox in an APP

slinder
6 - Meteoroid
HI All,

I am trying to configure a filter from a set of choices chosen from a list box in an analytical app.  I cannot figure out how to get the output from the list box to conform with the input that the filter requires.  Can anyone point me to an example?

Thanks,
4 REPLIES 4
KenB
6 - Meteoroid
From this article: https://alteryx-community.force.com/Getting-Started/Tips-and-Tricks/Tips-and-Tricks-2013-v1
In the Tips and Tricks pdf there is this:
Analytic App – Update an IN Clause from Tree Selection on pg 72.  It is for a Tree selection, but it may help.

Ken
slinder
6 - Meteoroid
Thanks for your help Ken.
ChadM
Alteryx Alumni (Retired)

Hi Ken!

Great question.  The List Box Tool will separate out each selection by a newline character, which can be parsed using Regex.  Check out the sample under File -> Open Sample -> Analytic Apps -> Tree Custom XML.  If you go into the Action Tool, you'll see it uses a Formula to create a new IN() clause in the filter.  This specifically uses the Regex_Replace function to replace any instance of a newline character ( ) with a comma.

It is important to note that with the Filter Tool, it is a good idea to create a completely new expression that replaces your entire old existing expression.  In the app mentioned, the entire expression is as follows:

IF 
length([CustomXMLTree]) == 1 then '1 == 1' 
ELSE 
'[Key] in ("' + REGEX_Replace([CustomXMLTree], ' ', '","') + '")' + 
' or left([Key],2) in ("' + REGEX_Replace([CustomXMLTree], ' ', '","') + '")'
ENDIF

In plain english, this is saying that if the selection on the tree has a length of 1 (in this case the entire USA selection), make my Filter Tool expression 1==1, which will pass through all records.  Otherwise, if any other individual selection is made (let's use Alabama, key '01' and Alaska, key '02' as an example), use the expression [Key] in ("01","02") or left([Key],2) in ("01","02")

Give it a shot, and if you have any issues let us know at support@alteryx.com.

Thank you!

Chad
slinder
6 - Meteoroid
Thanks foir helping Chad.  I believe the format of list box output is a string of a single line with one set of quote marks.  Something like "value1=false, value2=True, Value3=False".

Labels
Top Solution Authors