<?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: Running a script after making a change. Not working without closing and re-opening the script -why? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421180#M66999</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );
Clear Symbols();
getDataTable = getDataTable4partID("partID","partIDname"); 
include ("plotallcharts.jsl"); 
include ("generateJournal.jsl");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I assume that this is your first section of your code. Correct?&lt;/P&gt;
&lt;P&gt;Your third line in the code is looking for a function called "getDataTable4partID".&amp;nbsp; That function has not been defined when the code attempts to run that line.&amp;nbsp; You need to have the function definition executed before it can be called.&lt;/P&gt;</description>
    <pubDate>Sun, 26 Sep 2021 21:46:13 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2021-09-26T21:46:13Z</dc:date>
    <item>
      <title>Running a script after making a change. Not working without closing and re-opening the script -why?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421144#M66992</link>
      <description>&lt;P&gt;I am learning JSL and getting a behaviour which I do not think I got when I started. I would like to know if this behaviour is expected or if it is occurring due to a setting change I may have made inadvertently.&lt;/P&gt;&lt;P&gt;I have a simple "main" script which calls a function and another script. When I open JMP fresh and run fresh the main script or the other function/scripts it calls, all of them run fine and produce expected results. However, they do not work when I make a change in any of them (e.g. if I comment the script which is included in the main script, e.g. the last line below). If I close all the open scripts then re-fire them they work again. Coming from other programming languages I do not expect such a behaviour. Any direction is much appreciated&lt;/P&gt;&lt;P&gt;Examples of my mainscript below (I am on JMP13).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;getDataTable = getDataTable4partID("partID","partIDname");
include ("plotallcharts.jsl");
include ("generateJournal.jsl");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Commenting the last line above (or if I uncomment clear log ()) i.e.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//clear log ();
getDataTable = getDataTable4partID("partID","partIDname");
include ("plotallcharts.jsl");
//include ("generateJournal.jsl");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;gives me the following error in the above script&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Name Unresolved: getDataTable4partID in access or evaluation of 'getDataTable4partID' , getDataTable4partID( "partID", "partIDname" ) /*###*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Closing all open scripts and functions (and sometimes JMP) and firing back them again seems to get everything working again. Not sure what is going on....&lt;/P&gt;&lt;P&gt;Any direction is much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:57:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421144#M66992</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-06-09T19:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Running a script after making a change. Not working without closing and re-opening the script -why?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421155#M66993</link>
      <description>&lt;P&gt;In your example, I do not see where you define the function&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="jsl"&gt;getDataTable4partID&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;JSL is an interpreted language, and requires the creation of any items referenced in the code, prior to the calling of it.&amp;nbsp; It is not a compiled language, which first passes through all of the code and identifying functions etc.&amp;nbsp; Now what can be confusion is that once the function is defined, it will remain in memory and available until it is cleared with a&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;clear symbols();&lt;BR /&gt;//&amp;nbsp;or&lt;BR /&gt;clear&amp;nbsp;globals();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you follow through your code with this in mind, you may see why your JSL cannot find the function.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Sep 2021 20:00:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421155#M66993</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-09-26T20:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: Running a script after making a change. Not working without closing and re-opening the script -why?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421169#M66996</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/t5/Discussions/What-is-wrong-in-my-function-call/m-p/419802#M66873" target="_self"&gt;Here is the function&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;getDataTable4partID&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Are you suggesting that I use&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;clear symbols();
// clear globals();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;at the top of my main script?&lt;/P&gt;&lt;P&gt;If yes, then I have tired it without any change in behaviour.&lt;/P&gt;&lt;P&gt;Also, I forgot to mention above that when the main script does not run (after making a change in it) and I need to restart JMP to make the script run as expected again, I also need to run the function my main script is calling, once,&amp;nbsp; without which my main script does not run. This is clearly an undesirable behaviour and I worry that I am not doing things properly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Sep 2021 20:41:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421169#M66996</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2021-09-26T20:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Running a script after making a change. Not working without closing and re-opening the script -why?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421178#M66997</link>
      <description>&lt;P&gt;Your should start your whole script with:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );
Clear Symbols();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will stabilize the Namespace environment and clear out all of&amp;nbsp; the previous values, thus starting you fresh each time you run the code from the top.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Sep 2021 20:39:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421178#M66997</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-09-26T20:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Running a script after making a change. Not working without closing and re-opening the script -why?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421179#M66998</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;. OK so this is what I did and now my scripts and functions are not working even after closing and re-running or after restarting JMP.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My main script&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );
Clear Symbols();
getDataTable = getDataTable4partID("partID","partIDname"); 
include ("plotallcharts.jsl"); 
include ("generateJournal.jsl");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;My function is (without database details)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here (1)
getDataTable4PartID = Function({PartID}, {dtTemp},
	dtTemp = Open Database("connectionstring",
		"select '" || PartID || "' as value
		from dual",
		PartID
	);
	return(dtTemp);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and my script&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;plotallcharts.jsl;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;also has its fist line as&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here (1)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am still getting the error&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Name Unresolved: getDataTable4partID in access or evaluation of 'getDataTable4partID' , getDataTable4partID( "partID", "partIDname" ) /*###*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but sometimes the log is not showing anything upon running the main script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Sep 2021 21:44:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421179#M66998</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2021-09-26T21:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Running a script after making a change. Not working without closing and re-opening the script -why?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421180#M66999</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );
Clear Symbols();
getDataTable = getDataTable4partID("partID","partIDname"); 
include ("plotallcharts.jsl"); 
include ("generateJournal.jsl");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I assume that this is your first section of your code. Correct?&lt;/P&gt;
&lt;P&gt;Your third line in the code is looking for a function called "getDataTable4partID".&amp;nbsp; That function has not been defined when the code attempts to run that line.&amp;nbsp; You need to have the function definition executed before it can be called.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Sep 2021 21:46:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421180#M66999</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-09-26T21:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Running a script after making a change. Not working without closing and re-opening the script -why?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421187#M67000</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;/P&gt;&lt;P&gt;The function&amp;nbsp;&lt;SPAN&gt;getDataTable4partID has been defined, saved and executed. It was working as expected before. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;No longer and also not working are the main script calling it or the other included script in the main script.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Sep 2021 22:10:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421187#M67000</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2021-09-26T22:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Running a script after making a change. Not working without closing and re-opening the script -why?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421364#M67017</link>
      <description>&lt;P&gt;Adding&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;include ("getDataTable4partID.jsl");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;before the function call (&lt;CODE class=" language-jsl"&gt;getDataTable4partID.jsl being&amp;nbsp;the&amp;nbsp;name&amp;nbsp;of&amp;nbsp;the&amp;nbsp;function&amp;nbsp;script&lt;/CODE&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;getDataTable = getDataTable4partID("partID","partIDname"); &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );
Clear Symbols();
include (''getDataTable4partID.jsl");
getDataTable = getDataTable4partID("partID","partIDname"); 
include ("plotallcharts.jsl"); 
include ("generateJournal.jsl");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;seems to have solved all the issues. What is the reason?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 14:44:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421364#M67017</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2021-09-27T14:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Running a script after making a change. Not working without closing and re-opening the script -why?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421372#M67021</link>
      <description>&lt;P&gt;The function needs to be parsed before it can be called.&amp;nbsp; The JSL interpreter steps down through the code one line at a time.&amp;nbsp; If it has not stepped through the function code before you attempt to call that function, JSL will stop.&amp;nbsp; The same is true for all variable etc. in JSL. Thus:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );
Clear Symbols();
print( a );
a = 42;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Will fail with&lt;/P&gt;
&lt;PRE&gt;Name Unresolved: a in access or evaluation of 'a' , a/*###*/

at line 3 in Script 4.jsl&lt;/PRE&gt;
&lt;P&gt;While&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );
Clear Symbols();
a = 42;
print( a );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will run without error&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 15:24:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421372#M67021</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-09-27T15:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Running a script after making a change. Not working without closing and re-opening the script -why?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421434#M67024</link>
      <description>&lt;P&gt;Please excuse me for my ignorance, but is this your explanation for why I need to use&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;include ("getDataTable4partID.jsl");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;for my function call to work?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 19:49:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421434#M67024</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2021-09-27T19:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Running a script after making a change. Not working without closing and re-opening the script -why?</title>
      <link>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421439#M67025</link>
      <description>&lt;P&gt;Yes, the getDataTable4partID function must be parsed by JSL prior to you being able to call it.&amp;nbsp; The include statement, reads in the function, and loads it into memory.&amp;nbsp; Once it is in memory, it can be called.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 19:52:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Running-a-script-after-making-a-change-Not-working-without/m-p/421439#M67025</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-09-27T19:52:41Z</dc:date>
    </item>
  </channel>
</rss>

