<?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 JSL Basics in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/732#M732</link>
    <description>&lt;P&gt;Lets face it, JSL isn't the most user friendly language to use. It is mostly designed for you to back up your data after working on a lengthy project. With that being said, there are many usefull things you can do with it. This thread is dedicated to the basics of JSL. If I leave out some things, and I will, please feel free to reply and help out the users of JMP, so it isn't as hard as it was for me to learn JSL. &lt;BR /&gt;&lt;BR /&gt;Functions:&lt;BR /&gt;Functions are a good way of reusing code if you need to use it over and over. The functions in JSL have all the things you would expect, a specific user set name, input parameters, and a return value. This function also shows how to parse a comma delimited text file. Syntax below. &lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;funcName = Function( {param1},
	{return1},
	textFile = Load Text File( param1 ); // Reads a text File called param1
	// Parses through the file which is comma delimited and gets a list of words
	return1 = Words( textFile, "," );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To Call the function and assign the return value:&lt;BR /&gt;wordss = funcName( "fileName.txt" )&lt;BR /&gt;If Statemens:&lt;BR /&gt;The if statement works sort of like you would expect, but the syntax is a little different. Here is an example:&lt;/P&gt;
&lt;P&gt;For Loops:&lt;BR /&gt;The for loops are very similar to the traditional for loop. It has the three part syntax with the chunk that gets looped. The first chunk is for initialization, the second is conditional, the third is the "Do after loop" chunk. It will make more sense in a second.&lt;BR /&gt;In JSL a fourth chunk is added which is all statements to be executed. Syntax below:&lt;/P&gt;
&lt;P&gt;This is just the basics, I will add more to this thread later. Hopefully people contribute to make it very benificial. Thanks all.&lt;BR /&gt;-KaptainKodie&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jul 2018 18:07:25 GMT</pubDate>
    <dc:creator />
    <dc:date>2018-07-23T18:07:25Z</dc:date>
    <item>
      <title>JSL Basics</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/732#M732</link>
      <description>&lt;P&gt;Lets face it, JSL isn't the most user friendly language to use. It is mostly designed for you to back up your data after working on a lengthy project. With that being said, there are many usefull things you can do with it. This thread is dedicated to the basics of JSL. If I leave out some things, and I will, please feel free to reply and help out the users of JMP, so it isn't as hard as it was for me to learn JSL. &lt;BR /&gt;&lt;BR /&gt;Functions:&lt;BR /&gt;Functions are a good way of reusing code if you need to use it over and over. The functions in JSL have all the things you would expect, a specific user set name, input parameters, and a return value. This function also shows how to parse a comma delimited text file. Syntax below. &lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;funcName = Function( {param1},
	{return1},
	textFile = Load Text File( param1 ); // Reads a text File called param1
	// Parses through the file which is comma delimited and gets a list of words
	return1 = Words( textFile, "," );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To Call the function and assign the return value:&lt;BR /&gt;wordss = funcName( "fileName.txt" )&lt;BR /&gt;If Statemens:&lt;BR /&gt;The if statement works sort of like you would expect, but the syntax is a little different. Here is an example:&lt;/P&gt;
&lt;P&gt;For Loops:&lt;BR /&gt;The for loops are very similar to the traditional for loop. It has the three part syntax with the chunk that gets looped. The first chunk is for initialization, the second is conditional, the third is the "Do after loop" chunk. It will make more sense in a second.&lt;BR /&gt;In JSL a fourth chunk is added which is all statements to be executed. Syntax below:&lt;/P&gt;
&lt;P&gt;This is just the basics, I will add more to this thread later. Hopefully people contribute to make it very benificial. Thanks all.&lt;BR /&gt;-KaptainKodie&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jul 2018 18:07:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/732#M732</guid>
      <dc:creator />
      <dc:date>2018-07-23T18:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Basics</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/733#M733</link>
      <description>Thanks Kaptain,&lt;BR /&gt;&lt;BR /&gt;I will eagerly follow this thread. I am just about to translate a massive excel vba macro to jsl (vba is currently a no-no on the mac) and I appreciate that you share your insights with us. It will definately speed up learning the jsl basics (and beyond).&lt;BR /&gt;&lt;BR /&gt;Right now I am frustratingly trying to find a way to automate export of graphs etc. in eps or pdf to facilitate import into Adobe Illustrator for giving the final touches to the graphics. I have managed to get around this problem via the save as pict which retains the vectors and fonts but the result is not perfect or very predictable.</description>
      <pubDate>Fri, 11 Sep 2009 20:11:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/733#M733</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2009-09-11T20:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Basics</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/734#M734</link>
      <description>Thanks for the tips Kaptain.  I'm an experienced programmer but JSL still throws me a loop every once in a while.  Here are some of my experiences:&lt;BR /&gt;&lt;BR /&gt;I use functions now and then, but they don't always operate the same way as the JSL code in your "main" routine.  I have a function that does a tabulation and then an optional sort on a dataset.  To get it to work I had to use many calls to expr, eval and eval expr.  Took many emails to the help desk to get it to finally work.&lt;BR /&gt;&lt;BR /&gt;I've switched over to using a different approach, namely include files.  Instead of calling a function I do this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The Get Dataset.JSL program resides in the same directory as the calling program.  It sets the variable current_dataset.  The advantage of this approach is that I no longer need complex calls to eval, eval expr and expr.  The call to THROW halts execution of the main program.&lt;BR /&gt;&lt;BR /&gt;Message was edited by: PMroz</description>
      <pubDate>Fri, 23 Apr 2010 18:29:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/734#M734</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2010-04-23T18:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Basics</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/735#M735</link>
      <description>One more tip regarding IF statements. They can be confusing to read&lt;BR /&gt;later on, so I use a lot of comments to help. Using your example:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;BR /&gt; style="font-family: Courier New;"&amp;gt;n = 3;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt; style="font-family: Courier New;"&amp;gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New;"&gt;If&lt;BR /&gt;( n &amp;lt; 0, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt; style="font-family: Courier New;"&amp;gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;// then&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt; style="font-family: Courier New;"&amp;gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;print ( "Less than 0" );&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt; style="font-family: Courier New;"&amp;gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;print ( "This example is weak" ), &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt; style="font-family: Courier New;"&amp;gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;// else if&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt; style="font-family: Courier New;"&amp;gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;n &amp;gt; 0, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt; style="font-family: Courier New;"&amp;gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;// then&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt; style="font-family: Courier New;"&amp;gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;print ( "Greater than 0" ),&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt; style="font-family: Courier New;"&amp;gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;// else&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt; style="font-family: Courier New;"&amp;gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;print ( "Is Zero" )&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt; style="font-family: Courier New;"&amp;gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This is a relatively simple example, but this technique helps me (and&lt;BR /&gt;other programmers!) understand complex code, especially after not&lt;BR /&gt;looking at it for a while.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Message was edited by: PMroz</description>
      <pubDate>Fri, 23 Apr 2010 18:36:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/735#M735</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2010-04-23T18:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Basics</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/736#M736</link>
      <description>I normally just use tabs for indenting all my IF statements, but I'm going to try that comment thing to make it easier to read.  That should help a lot! Thanks!</description>
      <pubDate>Fri, 23 Apr 2010 19:50:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/736#M736</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-04-23T19:50:13Z</dc:date>
    </item>
    <item>
      <title>Formula evaluations in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/737#M737</link>
      <description>This was my earliest problem in JSL.  Forcing the table to evaluate formulas before continuing.&lt;BR /&gt;&lt;BR /&gt;Before adding a bunch of formula columns, do the following:&lt;BR /&gt;dt &amp;lt;&amp;lt; suppress formula eval(1) &amp;lt;&amp;lt;   &lt;THEN insert="" your="" new="" columns="" here=""&gt;;&lt;BR /&gt;dt &amp;lt;&amp;lt; suppress formula eval(0) &amp;lt;&amp;lt; run formulas();  //put this after the new columns&lt;BR /&gt;&lt;BR /&gt;Otherwise future operations on the table/rows/columns/values may run before it's done with the formulas on every row.  This caused me a lot of heartache when I first started JSL.&lt;/THEN&gt;</description>
      <pubDate>Fri, 23 Apr 2010 20:04:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/737#M737</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-04-23T20:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Formula evaluations in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/738#M738</link>
      <description>I don't do the suppress formula, but I ALWAYS do dt&amp;lt;&lt;RUN formulas=""&gt;&lt;/RUN&gt;&lt;BR /&gt;Good thread.  I think it would be great if more people used JSL. It's quite powerful, but not documented well enough in my opinion and so can be a bit tricky to use. It also tends to change from version to version and so your scripts can break even going from x.01 to x.02.</description>
      <pubDate>Sun, 25 Apr 2010 00:37:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Basics/m-p/738#M738</guid>
      <dc:creator>gh</dc:creator>
      <dc:date>2010-04-25T00:37:52Z</dc:date>
    </item>
  </channel>
</rss>

