<?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: Modal Box If Statement Not Assigning Value to Variable in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Modal-Box-If-Statement-Not-Assigning-Value-to-Variable/m-p/518021#M74426</link>
    <description>&lt;P&gt;The issue is that you have a comma after the statement instead of a semicolon&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;x = cb&amp;lt;&amp;lt;Get(),&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The On Validate() function has only 1 element&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;On Validate( expr )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When there is a comma after the statement, JMP sees&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;On Validate( expr, expr );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and it executes only the first element&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jul 2022 10:33:07 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2022-07-06T10:33:07Z</dc:date>
    <item>
      <title>Modal Box If Statement Not Assigning Value to Variable</title>
      <link>https://community.jmp.com/t5/Discussions/Modal-Box-If-Statement-Not-Assigning-Value-to-Variable/m-p/518005#M74424</link>
      <description>&lt;P&gt;Using the code below I offer the user the choice of 4 products to analyse.&lt;/P&gt;&lt;P&gt;I use an if statement to open the correct file for the correct product.&lt;/P&gt;&lt;P&gt;I also assign a number for a variable I will need at a later date.&lt;/P&gt;&lt;P&gt;When I attempt to print this variable I get an error saying Name Unresolved at line 18.&lt;/P&gt;&lt;P&gt;It appears time_mult is somehow not being properly defined.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;win = New Window( "Product Choice",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;On Validate(x = cb&amp;lt;&amp;lt;Get(),
		If(x == 1, y="File Path 1" ; time_mult=24,
		   x == 2, y="File Path 2" ; time_mult=168,
		   x == 3, y="File Path 3" ; time_mult=168,
		   x == 4, y="File Path 4" ; time_mult=168,
		);
	),
	cb = Combo Box(
		{"Product 1", "Product 2", "Product 3", "Product 4"},
	),
	Button Box("OK"),
	Button Box("Cancel"),
);
Print(x);
Print(y);
Print(time_mult);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following test code works perfectly and seems to me to look almost identical. I was wondering if anyone can identify what's going wrong&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;win = New Window( "Combo Box",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;On Validate(x = cb&amp;lt;&amp;lt;Get();
		If(x == 1, y="/H:/Example Folder/File 1.xlsx" ; z=5,
		   x == 2, y="/H:/Example Folder/File 2.xlsx" ; z=63,
		   Stop()
		);
	),
	cb = Combo Box(
		{"One", "Two"},
	),
	Button Box("OK"),
	Button Box("Cancel"),
);

Print(x);
Print(y);
print(z);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:03:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Modal-Box-If-Statement-Not-Assigning-Value-to-Variable/m-p/518005#M74424</guid>
      <dc:creator>Jemster</dc:creator>
      <dc:date>2023-06-09T17:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Modal Box If Statement Not Assigning Value to Variable</title>
      <link>https://community.jmp.com/t5/Discussions/Modal-Box-If-Statement-Not-Assigning-Value-to-Variable/m-p/518018#M74425</link>
      <description>&lt;P&gt;I needed a semi colon at the end of line 3&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 10:24:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Modal-Box-If-Statement-Not-Assigning-Value-to-Variable/m-p/518018#M74425</guid>
      <dc:creator>Jemster</dc:creator>
      <dc:date>2022-07-06T10:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: Modal Box If Statement Not Assigning Value to Variable</title>
      <link>https://community.jmp.com/t5/Discussions/Modal-Box-If-Statement-Not-Assigning-Value-to-Variable/m-p/518021#M74426</link>
      <description>&lt;P&gt;The issue is that you have a comma after the statement instead of a semicolon&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;x = cb&amp;lt;&amp;lt;Get(),&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The On Validate() function has only 1 element&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;On Validate( expr )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When there is a comma after the statement, JMP sees&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;On Validate( expr, expr );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and it executes only the first element&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 10:33:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Modal-Box-If-Statement-Not-Assigning-Value-to-Variable/m-p/518021#M74426</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-07-06T10:33:07Z</dc:date>
    </item>
  </channel>
</rss>

