<?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: How to apply &amp;quot;Max Selected&amp;quot; to a check box list in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-apply-quot-Max-Selected-quot-to-a-check-box-list/m-p/350875#M60046</link>
    <description>&lt;P&gt;There is not a Max Selected message that can be set, however one can write a script to do it.&amp;nbsp; Here is my way of handling it&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
New Window( "Example",
	cb = Check Box(
		{"One", "Two", "Three"},
		curSelected = cb &amp;lt;&amp;lt; get selected;
		If( N Items( curSelected ) &amp;gt; 2, 
			// Determine the one just selected
			For( i = 1, i &amp;lt;= N Items( cb &amp;lt;&amp;lt; get items ), i++,
				If(
					Contains( curSelected, (cb &amp;lt;&amp;lt; get items)[i] ) &amp;gt; 0 &amp;amp; 
						Contains( prevSelected, (cb &amp;lt;&amp;lt; get items)[i] ) == 0,
						dialog("Too many selections");
						cb &amp;lt;&amp;lt; set(i,0);
						Break();
				)
			);
		,
			prevSelected = curSelected;
		);
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 19 Jan 2021 17:31:42 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2021-01-19T17:31:42Z</dc:date>
    <item>
      <title>How to apply "Max Selected" to a check box list</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-apply-quot-Max-Selected-quot-to-a-check-box-list/m-p/350856#M60045</link>
      <description>&lt;P&gt;Hi, Is it possible to apply the "Max Selected" filter to limit the number of Check Boxes that a User can select?&lt;/P&gt;&lt;P&gt;I will appreciate your suggestions.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
New Window( "Example",
	cb = Check Box(
		{"One", "Two", "Three"}, Max Selected(2),
		Print(
			"Selected: " ||
			Concat Items( cb &amp;lt;&amp;lt; Get Selected(), ", " )
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:03:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-apply-quot-Max-Selected-quot-to-a-check-box-list/m-p/350856#M60045</guid>
      <dc:creator>ALopez</dc:creator>
      <dc:date>2023-06-09T22:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply "Max Selected" to a check box list</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-apply-quot-Max-Selected-quot-to-a-check-box-list/m-p/350875#M60046</link>
      <description>&lt;P&gt;There is not a Max Selected message that can be set, however one can write a script to do it.&amp;nbsp; Here is my way of handling it&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
New Window( "Example",
	cb = Check Box(
		{"One", "Two", "Three"},
		curSelected = cb &amp;lt;&amp;lt; get selected;
		If( N Items( curSelected ) &amp;gt; 2, 
			// Determine the one just selected
			For( i = 1, i &amp;lt;= N Items( cb &amp;lt;&amp;lt; get items ), i++,
				If(
					Contains( curSelected, (cb &amp;lt;&amp;lt; get items)[i] ) &amp;gt; 0 &amp;amp; 
						Contains( prevSelected, (cb &amp;lt;&amp;lt; get items)[i] ) == 0,
						dialog("Too many selections");
						cb &amp;lt;&amp;lt; set(i,0);
						Break();
				)
			);
		,
			prevSelected = curSelected;
		);
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jan 2021 17:31:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-apply-quot-Max-Selected-quot-to-a-check-box-list/m-p/350875#M60046</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-19T17:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply "Max Selected" to a check box list</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-apply-quot-Max-Selected-quot-to-a-check-box-list/m-p/350876#M60047</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;, I was afraid that the answer was going to be: No. Very nice your work-around, I will try to implement it in my code.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 18:06:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-apply-quot-Max-Selected-quot-to-a-check-box-list/m-p/350876#M60047</guid>
      <dc:creator>ALopez</dc:creator>
      <dc:date>2021-01-19T18:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply "Max Selected" to a check box list</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-apply-quot-Max-Selected-quot-to-a-check-box-list/m-p/350881#M60050</link>
      <description>&lt;P&gt;All you need to do for such items as your "Max Selected" message you suggested, is to go to the Scripting Index and look at the CheckBox entry.&amp;nbsp; And if you don't see a message that will do what you are suggesting, then there isn't such a capability directly from the object&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 19:16:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-apply-quot-Max-Selected-quot-to-a-check-box-list/m-p/350881#M60050</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-19T19:16:09Z</dc:date>
    </item>
  </channel>
</rss>

