<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cascading Multi-selects: Only showing unique choices in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/cascading-multi-selects-only-showing-unique/m-p/1094229#M36864</link>
    <description>&lt;P&gt;Thanks for the response.&lt;/P&gt;&lt;P&gt;I tried setting it to "no" and leaving it blank, and both had the same result as leaving it as yes, which was the default.&lt;/P&gt;&lt;P&gt;I think that setting is supposed to be if you want your choice to show up under multiple filters, e.g. If the previous answer to the filter question was "Shirt", rather than having your choice show up after selecting multiple (e.g. "Shirt" and "Pants").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another thing that might be adding a wrinkle to this is that Iʻm referencing an external csv for this question, so maybe that changes whether or not the setting applies?&lt;/P&gt;</description>
    <pubDate>Wed, 01 Sep 2021 00:01:14 GMT</pubDate>
    <dc:creator>AlfredBaldenweck</dc:creator>
    <dc:date>2021-09-01T00:01:14Z</dc:date>
    <item>
      <title>Cascading Multi-selects: Only showing unique choices</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/cascading-multi-selects-only-showing-unique/m-p/1093304#M36781</link>
      <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-survey123-questions/using-the-answers-to-a-multiple-select-question-to/m-p/1091284" target="_blank" rel="noopener"&gt;Kind of a follow-up to this post&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I have a list describing the contents of someone's closet. I'm taking inventory of this closet while I fill out this survey, but I really only care about what colors are represented in the assemblage. So I want to know what color shirts are in the closet, regardless of what style they are.&lt;/P&gt;&lt;P&gt;Example table (pivoted for readability)&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="25px"&gt;&lt;U&gt;&lt;STRONG&gt;Item Type&lt;/STRONG&gt;&lt;/U&gt;&lt;/TD&gt;&lt;TD height="25px"&gt;&lt;U&gt;&lt;STRONG&gt;Item Style&lt;/STRONG&gt;&lt;/U&gt;&lt;/TD&gt;&lt;TD height="25px"&gt;&lt;U&gt;&lt;STRONG&gt;Colors possible in that Style&lt;/STRONG&gt;&lt;/U&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;Shirt&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;Collared&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;Blue (Navy), Blue (Pale), Green, Red&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;Henley&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;Blue (Pale), Grey,&amp;nbsp; White&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;T-Shirt&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;Green, Grey, Purple, Red&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;Tank-top&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;Black, Blue (Navy), Grey, Green, Purple&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;If someone selects a Collared shirt&amp;nbsp; and Tank-top, the full set of choices will appear.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;U&gt;&lt;STRONG&gt;Item Style&lt;/STRONG&gt;&lt;/U&gt;&lt;/TD&gt;&lt;TD&gt;&lt;U&gt;&lt;STRONG&gt;Colors possible&lt;/STRONG&gt;&lt;/U&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Collared, Tank-top&lt;/TD&gt;&lt;TD width="50%"&gt;Blue (Navy), Black, Blue (Pale), Blue (Navy), Green, Grey, Red, Green, Purple&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;(&lt;EM&gt;Survey123 puts the choices as A[0], B[0], A[1], B[1], etc...)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Since I only care about the color of his entire collection of shirts, &lt;STRONG&gt;how can I make a clean list of unique choices appear?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="47px"&gt;Collared, Tank-top&lt;/TD&gt;&lt;TD width="50%" height="47px"&gt;Black, Blue (Navy), Blue (Pale), Green, Grey, Purple, Red&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;(If this were really what the survey was, I would cascade in reverse, starting with colors, then going to Styles, but that's not possible with my actual dataset.)&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 21:46:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/cascading-multi-selects-only-showing-unique/m-p/1093304#M36781</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2021-08-27T21:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Cascading Multi-selects: Only showing unique choices</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/cascading-multi-selects-only-showing-unique/m-p/1093629#M36801</link>
      <description>&lt;P&gt;Have you looked at the allow duplicate choice option?&amp;nbsp; Not sure but it may filter for you.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-survey123-ideas/survey123connect-choices-duplicate-names-amp/idi-p/1053712" target="_blank"&gt;https://community.esri.com/t5/arcgis-survey123-ideas/survey123connect-choices-duplicate-names-amp/idi-p/1053712&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 15:42:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/cascading-multi-selects-only-showing-unique/m-p/1093629#M36801</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-08-30T15:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Cascading Multi-selects: Only showing unique choices</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/cascading-multi-selects-only-showing-unique/m-p/1094229#M36864</link>
      <description>&lt;P&gt;Thanks for the response.&lt;/P&gt;&lt;P&gt;I tried setting it to "no" and leaving it blank, and both had the same result as leaving it as yes, which was the default.&lt;/P&gt;&lt;P&gt;I think that setting is supposed to be if you want your choice to show up under multiple filters, e.g. If the previous answer to the filter question was "Shirt", rather than having your choice show up after selecting multiple (e.g. "Shirt" and "Pants").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another thing that might be adding a wrinkle to this is that Iʻm referencing an external csv for this question, so maybe that changes whether or not the setting applies?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 00:01:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/cascading-multi-selects-only-showing-unique/m-p/1094229#M36864</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2021-09-01T00:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: Cascading Multi-selects: Only showing unique choices</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/cascading-multi-selects-only-showing-unique/m-p/1096182#M37013</link>
      <description>&lt;P&gt;Update 9/7/2021&lt;/P&gt;&lt;P&gt;I'm having some limited success by placing the relevant items for each color into one cell, then using&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;contains(Animal, selected-at(${Animal}, '0') or&amp;nbsp;contains(Animal, selected-at(${Animal}, '1') or ...&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Sorry, I had to change dummy data&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;The problem is that it won't kick in until the number of choices that are enumerated in this choice filter are selected. So if I go all the way up to selected index 3, nothing will filter until I have 4 choices selected.&lt;/P&gt;&lt;P&gt;I'm now trying to figure out &lt;STRONG&gt;how to make it not tied to the number of selections&lt;/STRONG&gt; and could use some suggestions.&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Example photos:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Here is my choice list:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlfredBaldenweck_3-1631059163384.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22565iE11926A8A962577B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlfredBaldenweck_3-1631059163384.png" alt="AlfredBaldenweck_3-1631059163384.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;With Index up to index 1,&amp;nbsp;&lt;/U&gt;&lt;BR /&gt;No Choices:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlfredBaldenweck_0-1631059036374.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22562iEEEC8027BAEC92B4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlfredBaldenweck_0-1631059036374.png" alt="AlfredBaldenweck_0-1631059036374.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;One Choice:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlfredBaldenweck_1-1631059078952.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22563i032F978F22848F99/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlfredBaldenweck_1-1631059078952.png" alt="AlfredBaldenweck_1-1631059078952.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Two Choices selected:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlfredBaldenweck_2-1631059107749.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22564i858F1D0F0E2F9D59/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlfredBaldenweck_2-1631059107749.png" alt="AlfredBaldenweck_2-1631059107749.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 00:07:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/cascading-multi-selects-only-showing-unique/m-p/1096182#M37013</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2021-09-08T00:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Cascading Multi-selects: Only showing unique choices</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/cascading-multi-selects-only-showing-unique/m-p/1096591#M37057</link>
      <description>&lt;P&gt;Update 9/8/2021&lt;/P&gt;&lt;P&gt;Good news! I have gotten it to work.&lt;/P&gt;&lt;P&gt;Bad news: It is extremely tedious to set up.&lt;/P&gt;&lt;P&gt;Using the data I shared yesterday, this code will work for all of the options.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;if(count-selected(${Animal})=1, contains(Animal, selected-at(${Animal}, '0')), 
if(count-selected(${Animal})=2, (contains(Animal, selected-at(${Animal}, '0')) or contains(Animal, selected-at(${Animal}, '1'))), 
if(count-selected(${Animal})=3, (contains(Animal, selected-at(${Animal}, '0')) or contains(Animal, selected-at(${Animal}, '1')) or contains(Animal, selected-at(${Animal}, '2'))), 
if(count-selected(${Animal})=4, (contains(Animal, selected-at(${Animal}, '0')) or contains(Animal, selected-at(${Animal}, '1')) or contains(Animal, selected-at(${Animal}, '2')) or contains(Animal, selected-at(${Animal}, '3'))), 
if(count-selected(${Animal})=5, (contains(Animal, selected-at(${Animal}, '0')) or contains(Animal, selected-at(${Animal}, '1')) or contains(Animal, selected-at(${Animal}, '2')) or contains(Animal, selected-at(${Animal}, '3')) or contains(Animal, selected-at(${Animal}, '4'))),"")))))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can't actually put line breaks in the calculation field, or else it breaks the formula, so in real life it's even harder to read than this.&lt;/P&gt;&lt;P&gt;I'm hoping that there's a way to have a javascript script evaluate the number of selected choices and then build the filter statement from there. My real life data is upwards of 80 choices to deal with (even after paring it down with other filters first), so writing this out for that many possibilities is not ideal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a rough idea of what do, but don't know how to code well enough to&amp;nbsp; make it happen.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Get the count of the selected in the question (X)&lt;/LI&gt;&lt;LI&gt;&lt;STRIKE&gt;prepare statement S &lt;/STRIKE&gt;I just realized this isn't necessary&lt;UL&gt;&lt;LI&gt;&lt;PRE&gt;&lt;STRIKE&gt;"if(count-selected(${Animal})=", X, ", "&lt;/STRIKE&gt;&lt;/PRE&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;create a range from 1 to X, inclusive&lt;/LI&gt;&lt;LI&gt;For&amp;nbsp; integer Y in that range, concatenate into one large string, U&lt;UL&gt;&lt;LI&gt;&lt;PRE&gt;"contains(Animal, selected-at(${Animal},'", (Y-1), "'))", " or""&lt;/PRE&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Get rid of the last "or",&lt;STRIKE&gt; replace it with&amp;nbsp;&lt;/STRIKE&gt;&lt;/LI&gt;&lt;LI&gt;&lt;PRE&gt;&lt;STRIKE&gt;"), "")"&lt;/STRIKE&gt;&lt;/PRE&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRIKE&gt;Concatenate S, U&lt;/STRIKE&gt;&amp;nbsp;&amp;nbsp;Return U&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Specifically what I don't know how to do is creating a range, and then getting rid of the last "or".&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 00:03:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/cascading-multi-selects-only-showing-unique/m-p/1096591#M37057</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2021-09-09T00:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: Cascading Multi-selects: Only showing unique choices</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/cascading-multi-selects-only-showing-unique/m-p/1097841#M37146</link>
      <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-survey123-questions/using-pulldata-to-create-the-choice-filter/m-p/1097839/highlight/true#M37145" target="_blank" rel="noopener"&gt;Okay, I have a working solution&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code to generate the if() statements is&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;LI-CODE lang="javascript"&gt;function choicenum(N) {
	var index_range = [];

	//Create an index range based on the count-selected in the question.
	for (var i = 1; i &amp;lt;= N; i++) {
		index_range.push(i);
    }
	// Create your filter statements
	var filterstr = []
	for (var y in index_range) {  
      	var midstr = []
      	midstr.push("if(count-selected(${Animal})=" + (Number(y)+1) + ", ");
      	
		// Create a sub-index for the second clause of the if()
		var subindex= []
      	for (var f = 0; f &amp;lt;= y; f++) {
			subindex.push(f);
   		
      		midstr.push("contains(Animal, selected-at(${Animal}, '" + f + "' )) or ")
        }
      	// Concatenates into a string, joined by a dummy character
  		var split_char= "?"
  		midstr = midstr.join(split_char);
  		// splits along the dummy character and stitches back together
  		midstr= midstr.split(split_char).join('');
  		// Removes the last "or" from the string
  		midstr = midstr.substring(0, midstr.length -4)
		
     	filterstr.push(midstr);
	}
  
	filterstr = filterstr + ", \"\"" +")".repeat(N)
	return filterstr
  
}

//Outcome for N=2
//if(count-selected(${Animal})=1, contains(Animal, selected-at(${Animal}, '0' )),
//if(count-selected(${Animal})=2, contains(Animal, selected-at(${Animal}, '0' )) 
//or contains(Animal, selected-at(${Animal}, '1' )), ""))

console.log(choicenum(2))&lt;/LI-CODE&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;It's not the ideal solution; originally I had created a script that worked dynamically. Unfortunately, S123 can't use formulas that are the result of a pulldata() or are the values in another question as filter expressions; it instead tries to filter based off the string of the expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 23:35:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/cascading-multi-selects-only-showing-unique/m-p/1097841#M37146</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2021-09-13T23:35:03Z</dc:date>
    </item>
  </channel>
</rss>

