<?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 How to auto-run attached scripts on a table pulled from database in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-auto-run-attached-scripts-on-a-table-pulled-from-database/m-p/358026#M60818</link>
    <description>&lt;P&gt;Following code will attach all jsl scripts in c:\work directory to the table dt.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Do you know any function/command which can also make it auto-run on the table?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
dir = "C:\work";
fileNames = Files In Directory( dir );
if (dir!="",
	For( iFile = 1, iFile &amp;lt;= N Items( fileNames ), iFile++,
			filename = fileNames[iFile];
			show(filename);
			
			If( Ends With( filename, ".jsl" ),
				file_path = dir || "\" || filename;
				show(file_path);
				x = Load Text File( file_path );
				Eval( Parse( "dt &amp;lt;&amp;lt; new script(filename," || x || ")" ) );
			);
		);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Jun 2023 22:05:59 GMT</pubDate>
    <dc:creator>Dib-Dey</dc:creator>
    <dc:date>2023-06-09T22:05:59Z</dc:date>
    <item>
      <title>How to auto-run attached scripts on a table pulled from database</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-auto-run-attached-scripts-on-a-table-pulled-from-database/m-p/358026#M60818</link>
      <description>&lt;P&gt;Following code will attach all jsl scripts in c:\work directory to the table dt.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Do you know any function/command which can also make it auto-run on the table?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
dir = "C:\work";
fileNames = Files In Directory( dir );
if (dir!="",
	For( iFile = 1, iFile &amp;lt;= N Items( fileNames ), iFile++,
			filename = fileNames[iFile];
			show(filename);
			
			If( Ends With( filename, ".jsl" ),
				file_path = dir || "\" || filename;
				show(file_path);
				x = Load Text File( file_path );
				Eval( Parse( "dt &amp;lt;&amp;lt; new script(filename," || x || ")" ) );
			);
		);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:05:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-auto-run-attached-scripts-on-a-table-pulled-from-database/m-p/358026#M60818</guid>
      <dc:creator>Dib-Dey</dc:creator>
      <dc:date>2023-06-09T22:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to auto-run attached scripts on a table pulled from database</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-auto-run-attached-scripts-on-a-table-pulled-from-database/m-p/358042#M60819</link>
      <description>&lt;P&gt;The&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; run scripts( filename );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will run the script after it has been saved to the data table.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
dir = "C:\work";
fileNames = Files In Directory( dir );
if (dir!="",
	For( iFile = 1, iFile &amp;lt;= N Items( fileNames ), iFile++,
			filename = fileNames[iFile];
			show(filename);
			
			If( Ends With( filename, ".jsl" ),
				file_path = dir || "\" || filename;
				show(file_path);
				x = Load Text File( file_path );
				Eval( Parse( "dt &amp;lt;&amp;lt; new script(filename," || x || ")" ) );
				dt &amp;lt;&amp;lt; run scripts( filename );
			);
		);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want all of the scripts run whenever the data table is opened, you can add a table script called OnOpen where you could specify to run each of the table scripts.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 01:33:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-auto-run-attached-scripts-on-a-table-pulled-from-database/m-p/358042#M60819</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-02-11T01:33:50Z</dc:date>
    </item>
  </channel>
</rss>

