<?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: Function fails to Return User input from Modal Window in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Function-fails-to-Return-User-input-from-Modal-Window/m-p/346211#M59688</link>
    <description>&lt;P&gt;Thank you very much jthi!&amp;nbsp; Never thought of using an associative array.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jan 2021 22:11:51 GMT</pubDate>
    <dc:creator>ALopez</dc:creator>
    <dc:date>2021-01-06T22:11:51Z</dc:date>
    <item>
      <title>Function fails to Return User input from Modal Window</title>
      <link>https://community.jmp.com/t5/Discussions/Function-fails-to-Return-User-input-from-Modal-Window/m-p/346132#M59684</link>
      <description>&lt;P&gt;The purpose of this code is to get User input to generate a report.&amp;nbsp; The User will select the Month and the type.&amp;nbsp; The code partially works as shown but as soon as I try to convert it to a function that resides on another JSL file (called with an "include") it fails. I am not able to get the two variables returned and I always get a "Name unresolved" error.&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;I know that Month returns as a list and that the type returns as a string (?). What I am missing and how can I get the Month and the type returned by the function.&lt;BR /&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

monthLst = {"may", "June", "July"};

	nw = New Window( "Select Month",
		&amp;lt;&amp;lt;modal,
		Spacer Box( size( 25, 10 ) ),
		H List Box(
			V List Box(
				Text Box( Trim( "Please select Month and Type" ) ),
			
				Spacer Box( size( 10, 10 ) ),
				
				tb2 = List Box( "source", width( 300 ), nlines( 10 ), maxSelected( 1 ) ),
				tb2 &amp;lt;&amp;lt; append( monthLst );
				Spacer Box( size( 10, 10 ) ),
				
				cb = Combo Box({"&amp;lt;Select type&amp;gt;","Accounting", "Financial"},

					),

				Spacer Box( size( 10, 10 ) ),
				
				H List Box(
					Align( left ),
					Spacer Box(),
					Button Box( "Cancel", bbCancelled = 1 ),
					Button Box( "OK",
						bbCancelled = 0;
						selectMo = tb2 &amp;lt;&amp;lt; Get Selected;
						rcb = cb &amp;lt;&amp;lt; Get Selected;	
					)
				)
				
			),
			Spacer Box( size( 50, 10 ) )
		), 
		
		Spacer Box( size( 25, 30 ) )
	
	);

	If( bbCancelled == 1,
		Stop(),
		If( selectMo == {}, 
			//error modal
			::dialogModalNoEdit( "Please select a Month." );
			
			//recursively call modal window function
			SelExpModal( monthLst );
		, 
			//if values were selected return results
			//Return(selectMo[1] ),

		)
	);
Print(selectMo);
Print(rcb);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:02:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Function-fails-to-Return-User-input-from-Modal-Window/m-p/346132#M59684</guid>
      <dc:creator>ALopez</dc:creator>
      <dc:date>2023-06-09T22:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Function fails to Return User input from Modal Window</title>
      <link>https://community.jmp.com/t5/Discussions/Function-fails-to-Return-User-input-from-Modal-Window/m-p/346171#M59686</link>
      <description>&lt;P&gt;If I understand correctly..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are creating a function you will have to return values you want to use after function has been executed (unless you want to use global variables).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case you could return them for example like this (associative array would maybe be better):&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;return(selectMo, rcb);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And in script that includes that script you can access them:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
Include("MonthTypeFunc.jsl");
retVal = MonthTypeWindow();
show(retVal[1],retVal[2]);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Attached example scripts. Place in the same folder and run Main.jsl.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 20:30:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Function-fails-to-Return-User-input-from-Modal-Window/m-p/346171#M59686</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-01-06T20:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Function fails to Return User input from Modal Window</title>
      <link>https://community.jmp.com/t5/Discussions/Function-fails-to-Return-User-input-from-Modal-Window/m-p/346211#M59688</link>
      <description>&lt;P&gt;Thank you very much jthi!&amp;nbsp; Never thought of using an associative array.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 22:11:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Function-fails-to-Return-User-input-from-Modal-Window/m-p/346211#M59688</guid>
      <dc:creator>ALopez</dc:creator>
      <dc:date>2021-01-06T22:11:51Z</dc:date>
    </item>
  </channel>
</rss>

