<?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 Populating/Expand UI based on a selection in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Populating-Expand-UI-based-on-a-selection/m-p/53052#M30012</link>
    <description>&lt;P&gt;All,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; I found this post and example very relevant to my needs.&amp;nbsp;&lt;A href="https://community.jmp.com/t5/Discussions/Creating-drop-down-menu-for-interactive-user-input/td-p/17982" target="_blank"&gt;https://community.jmp.com/t5/Discussions/Creating-drop-down-menu-for-interactive-user-input/td-p/17982&lt;/A&gt;. However, as I try to implement/execute the code piece provided here, I don't see what I expected to happen. I think it is a typo, provided is my edited - working code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA\Big Class.jmp" );

/* Extract a list of unique ages */

Summarize( a = By( :age ) );

Insert Into( a, "&amp;lt;Select Age&amp;gt;", 1 );

/* Create a modal dialog */

New Window( "Example",

    &amp;lt;&amp;lt;Modal,

    H List Box(

        /* Upon selecting an age, populate the second ComboBox with corresponding names */

        Panel Box( "Select an Age:",

            cb1 = Combo Box(

                a,

                &amp;lt;&amp;lt;SetFunction(

                    Function( {this},

                        selection = this &amp;lt;&amp;lt; Get Selected();

                        r = dt &amp;lt;&amp;lt; Get Rows Where( :age == Num( selection ) );

                        ageNames = :name[r];               ///////////////////////////////// EDIT - Needs to be :name[r] and not :name
 
                        Insert Into( ageNames, "&amp;lt;Select Name&amp;gt;", 1 );

                        cb2 &amp;lt;&amp;lt; Set Items( ageNames );

                    )

                )

            )

        ),

        /* Print the selected values from both ComboBoxes in the log */

        Panel Box( "Select a Name:",

            cb2 = Combo Box(

                {"&amp;lt;Select Name&amp;gt;"},

                &amp;lt;&amp;lt;SetFunction(

                    Function( {this},

                        that=this&amp;lt;&amp;lt; Get Selected();

                        Print( selection, that  )

                    )

                )

            )

        )

    )

);

sel=num(selection)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at the code and reading through it, I was hoping once the user selects an age in the first Combo Box, the second Combo Box should be populated with the names of people with that age. However, I don't see that happening here with the original code. This above code fixes it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 305px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/9831iB3FCF53398880B85/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this the best way to handle this - Or are there other options ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Mar 2018 13:35:53 GMT</pubDate>
    <dc:creator>uday_guntupalli</dc:creator>
    <dc:date>2018-03-13T13:35:53Z</dc:date>
    <item>
      <title>Populating/Expand UI based on a selection</title>
      <link>https://community.jmp.com/t5/Discussions/Populating-Expand-UI-based-on-a-selection/m-p/53052#M30012</link>
      <description>&lt;P&gt;All,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; I found this post and example very relevant to my needs.&amp;nbsp;&lt;A href="https://community.jmp.com/t5/Discussions/Creating-drop-down-menu-for-interactive-user-input/td-p/17982" target="_blank"&gt;https://community.jmp.com/t5/Discussions/Creating-drop-down-menu-for-interactive-user-input/td-p/17982&lt;/A&gt;. However, as I try to implement/execute the code piece provided here, I don't see what I expected to happen. I think it is a typo, provided is my edited - working code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA\Big Class.jmp" );

/* Extract a list of unique ages */

Summarize( a = By( :age ) );

Insert Into( a, "&amp;lt;Select Age&amp;gt;", 1 );

/* Create a modal dialog */

New Window( "Example",

    &amp;lt;&amp;lt;Modal,

    H List Box(

        /* Upon selecting an age, populate the second ComboBox with corresponding names */

        Panel Box( "Select an Age:",

            cb1 = Combo Box(

                a,

                &amp;lt;&amp;lt;SetFunction(

                    Function( {this},

                        selection = this &amp;lt;&amp;lt; Get Selected();

                        r = dt &amp;lt;&amp;lt; Get Rows Where( :age == Num( selection ) );

                        ageNames = :name[r];               ///////////////////////////////// EDIT - Needs to be :name[r] and not :name
 
                        Insert Into( ageNames, "&amp;lt;Select Name&amp;gt;", 1 );

                        cb2 &amp;lt;&amp;lt; Set Items( ageNames );

                    )

                )

            )

        ),

        /* Print the selected values from both ComboBoxes in the log */

        Panel Box( "Select a Name:",

            cb2 = Combo Box(

                {"&amp;lt;Select Name&amp;gt;"},

                &amp;lt;&amp;lt;SetFunction(

                    Function( {this},

                        that=this&amp;lt;&amp;lt; Get Selected();

                        Print( selection, that  )

                    )

                )

            )

        )

    )

);

sel=num(selection)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at the code and reading through it, I was hoping once the user selects an age in the first Combo Box, the second Combo Box should be populated with the names of people with that age. However, I don't see that happening here with the original code. This above code fixes it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 305px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/9831iB3FCF53398880B85/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this the best way to handle this - Or are there other options ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 13:35:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Populating-Expand-UI-based-on-a-selection/m-p/53052#M30012</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-03-13T13:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: Populating/Expand UI based on a selection</title>
      <link>https://community.jmp.com/t5/Discussions/Populating-Expand-UI-based-on-a-selection/m-p/53055#M30015</link>
      <description>&lt;P&gt;The "Modal" window is not letting the flow of your code work.&amp;nbsp; If you change the window to a non modal window the code works as you described you want it to work..&amp;nbsp; I have added to your script to make it work the way you want it, without it being a modal window.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
Clear Symbols();
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );

/* Extract a list of unique ages */
Summarize( a = By( :age ) );
Insert Into( a, "&amp;lt;Select Age&amp;gt;", 1 );

/* Create a modal dialog */
nw = New Window( "Example", 
   // &amp;lt;&amp;lt;Modal,
	H List Box(

        /* Upon selecting an age, populate the second ComboBox with corresponding names */
		Panel Box( "Select an Age:", 

			cb1 = Combo Box(
				a,
				&amp;lt;&amp;lt;SetFunction(
					Function( {this},
						selection = this &amp;lt;&amp;lt; Get Selected();
						r = dt &amp;lt;&amp;lt; Get Rows Where( :age == Num( selection ) );
						ageNames = :name[r];               ///////////////////////////////// EDIT - Needs to be :name[r] and not :name 
						Insert Into( ageNames, "&amp;lt;Select Name&amp;gt;", 1 );
						cb2 &amp;lt;&amp;lt; Set Items( ageNames );
					)
				)
			)
		), 

        /* Print the selected values from both ComboBoxes in the log */
		Panel Box( "Select a Name:",
			cb2 = Combo Box(
				{"&amp;lt;Select Name&amp;gt;"},
				&amp;lt;&amp;lt;SetFunction(
					Function( {this},
						that = this &amp;lt;&amp;lt; Get Selected();
						Print( selection, that );
					)
				)
			)
		)
	),
	Button Box( "OK", nw &amp;lt;&amp;lt; close window; myPGM )
);
myPGM = Expr( sel = Num( selection ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Mar 2018 14:11:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Populating-Expand-UI-based-on-a-selection/m-p/53055#M30015</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-03-13T14:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Populating/Expand UI based on a selection</title>
      <link>https://community.jmp.com/t5/Discussions/Populating-Expand-UI-based-on-a-selection/m-p/53058#M30018</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hello Jim,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I could get the code sample from the other discussion&amp;nbsp; to work even&amp;nbsp; whille the window is Modal. The issue was in the original discussion, the code is not subsetting the selecting rows, which I added. However, I am wondering if this is the best way to do this or are there any better solutions ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 14:20:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Populating-Expand-UI-based-on-a-selection/m-p/53058#M30018</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-03-13T14:20:50Z</dc:date>
    </item>
  </channel>
</rss>

