SOLVED
Listbox in an APP
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
slinder
6 - Meteoroid
‎09-26-2014
02:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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,
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,
Solved! Go to Solution.
Labels:
- Labels:
- Apps
- Interface Tools
4 REPLIES 4
KenB
6 - Meteoroid
‎09-26-2014
02:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
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
‎09-26-2014
03:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks for your help Ken.
ChadM
Alteryx Alumni (Retired)
‎09-26-2014
04:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
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
‎09-26-2014
10:47 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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".
