<?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: Practicing on JSL for a newbie - Unexpected &amp;quot;{&amp;quot;. Perhaps there is a missing &amp;quot;;&amp;quot; or &amp;quot;,&amp;quot;. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Practicing-on-JSL-for-a-newbie-Unexpected-quot-quot-Perhaps/m-p/695550#M88059</link>
    <description>&lt;P&gt;I suggest that you take the time to read the Scripting Guide.&amp;nbsp; You will find it an efficient way to learn the structures and syntax of JSL.&lt;/P&gt;
&lt;P&gt;Concerning your code:&lt;/P&gt;
&lt;P&gt;Your If() statement syntax is incorrect.&amp;nbsp; The form of an If() statement is:&lt;/P&gt;
&lt;PRE&gt;If( condition1, result1, &amp;lt;condition2, result2&amp;gt;,...,&amp;lt;elseResult&amp;gt;)&lt;/PRE&gt;
&lt;P&gt;The error statement you received points to Line 7, Colum 21, the "{";&amp;nbsp; Your If() function has a condition but no result.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If (Is Missing(fn))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It has a condition, but the second ")" closes out the statement.&amp;nbsp; JMP then incounters the "{" and doesn't know what to do with it.&amp;nbsp; I believe what you really want is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Is Missing( fn ),
	Exit(), 
	// Else Open the selected file
	Open( fn )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I may also suggest that you may want to think long and hard about using&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Exit()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it terminates JMP.&lt;/P&gt;
&lt;P&gt;You may want to just stop the execution of the script, but leave the user with the JMP&amp;nbsp; session remaining open.&amp;nbsp; To do this, use the&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Throw()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;function.&lt;/P&gt;</description>
    <pubDate>Wed, 08 Nov 2023 07:32:56 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2023-11-08T07:32:56Z</dc:date>
    <item>
      <title>Practicing on JSL for a newbie - Unexpected "{". Perhaps there is a missing ";" or ",".</title>
      <link>https://community.jmp.com/t5/Discussions/Practicing-on-JSL-for-a-newbie-Unexpected-quot-quot-Perhaps/m-p/695540#M88057</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm practising on JSL to select a .jmp file to open through a file dialog window. If the user did not make a selection, to exit.&lt;BR /&gt;&lt;BR /&gt;However, I'm getting the below error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unexpected "{". Perhaps there is a missing ";" or ",".&lt;/P&gt;&lt;P&gt;Line 7 Column 21: if (Is Missing(fn)) ►{&lt;/P&gt;&lt;P&gt;The remaining text that was ignored was&lt;/P&gt;&lt;P&gt;{exit();}Open(fn);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My script below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Open a dialog to choose a .jmp file to open

// Get the filename of the .jmp file to open
fn = Pick File("Select a .jmp file to open", "", {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 1, "Default Filename.jmp");

// If the user did not select a file, exit the script
if (Is Missing(fn)) {
    exit();
}

// Open the selected file
Open(fn);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Appreciate if any one can point out what I'm missing here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 06:45:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Practicing-on-JSL-for-a-newbie-Unexpected-quot-quot-Perhaps/m-p/695540#M88057</guid>
      <dc:creator>BooBee</dc:creator>
      <dc:date>2023-11-08T06:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Practicing on JSL for a newbie - Unexpected "{". Perhaps there is a missing ";" or ",".</title>
      <link>https://community.jmp.com/t5/Discussions/Practicing-on-JSL-for-a-newbie-Unexpected-quot-quot-Perhaps/m-p/695549#M88058</link>
      <description>&lt;P&gt;You are using incorrect syntax ( use ( instead of } and ) instead of }, also end your expressions with ;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should go through&amp;nbsp;&lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/introduction-to-writing-jsl-scripts.shtml#" target="_blank"&gt;Scripting Guide (jmp.com)&lt;/A&gt;&amp;nbsp;while learning JSL. There are also courses regarding JSL, like here&amp;nbsp;&lt;LI-MESSAGE title="Introduction to the JMP Scripting Language Course" uid="539562" url="https://community.jmp.com/t5/Introduction-to-the-JMP/Introduction-to-the-JMP-Scripting-Language-Course/m-p/539562#U539562" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;, there is also material provided by JSL Scripters Club users group&amp;nbsp;&lt;A href="https://community.jmp.com/t5/JMP-Scripters-Club/gh-p/scripting-jug" target="_blank"&gt;JMP Scripters Club - JMP User Community&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 07:10:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Practicing-on-JSL-for-a-newbie-Unexpected-quot-quot-Perhaps/m-p/695549#M88058</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-11-08T07:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Practicing on JSL for a newbie - Unexpected "{". Perhaps there is a missing ";" or ",".</title>
      <link>https://community.jmp.com/t5/Discussions/Practicing-on-JSL-for-a-newbie-Unexpected-quot-quot-Perhaps/m-p/695550#M88059</link>
      <description>&lt;P&gt;I suggest that you take the time to read the Scripting Guide.&amp;nbsp; You will find it an efficient way to learn the structures and syntax of JSL.&lt;/P&gt;
&lt;P&gt;Concerning your code:&lt;/P&gt;
&lt;P&gt;Your If() statement syntax is incorrect.&amp;nbsp; The form of an If() statement is:&lt;/P&gt;
&lt;PRE&gt;If( condition1, result1, &amp;lt;condition2, result2&amp;gt;,...,&amp;lt;elseResult&amp;gt;)&lt;/PRE&gt;
&lt;P&gt;The error statement you received points to Line 7, Colum 21, the "{";&amp;nbsp; Your If() function has a condition but no result.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If (Is Missing(fn))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It has a condition, but the second ")" closes out the statement.&amp;nbsp; JMP then incounters the "{" and doesn't know what to do with it.&amp;nbsp; I believe what you really want is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Is Missing( fn ),
	Exit(), 
	// Else Open the selected file
	Open( fn )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I may also suggest that you may want to think long and hard about using&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Exit()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it terminates JMP.&lt;/P&gt;
&lt;P&gt;You may want to just stop the execution of the script, but leave the user with the JMP&amp;nbsp; session remaining open.&amp;nbsp; To do this, use the&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Throw()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;function.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 07:32:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Practicing-on-JSL-for-a-newbie-Unexpected-quot-quot-Perhaps/m-p/695550#M88059</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-11-08T07:32:56Z</dc:date>
    </item>
  </channel>
</rss>

