<?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: How to pass arguments to different jsl script ? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-pass-arguments-to-different-jsl-script/m-p/237445#M46889</link>
    <description>&lt;P&gt;You can pass the information to other JSL scripts via global variables.&amp;nbsp; These have the prefix "::"; I add a g to indicate that they're global.&amp;nbsp; For example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;::g_my_var = "Hello";
include("my_script.jsl");&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 05 Dec 2019 14:24:23 GMT</pubDate>
    <dc:creator>pmroz</dc:creator>
    <dc:date>2019-12-05T14:24:23Z</dc:date>
    <item>
      <title>How to pass arguments to different jsl script ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-arguments-to-different-jsl-script/m-p/237394#M46875</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a SQL database where we register data for different customers (and each customer has many tools).&lt;BR /&gt;I am in the process to create an automatic reports to monitor the tools performance from the SQL DB.&lt;BR /&gt;For one customer, I have a long script working (one long JSL) that connect to the SQL, run a query, save the table from the query, then modify/filter the table to get the data I need, then draw a few charts and save the results in a specific locations.&lt;BR /&gt;&lt;BR /&gt;In order to make it more simple to use, for maintenance and upgrade, I would like create different JSL scripts and use the Customer_Tool_Info.txt file ( see example attachedin the Zip) as a configuration file.&lt;BR /&gt;As we have a lot of customers then I could simply use a For loop using this config file to create all the reports we need.&lt;BR /&gt;The Customer_Tool_Info.txt contains information for customer, tools and the infos for the ODBC connection.&lt;BR /&gt;What I would like is to have the main script to open the Customer_Tool_Info.txt and extract the needed infos and pass them as arguments for the other sub-scripts.&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Main_script.jsl ( Get the arguments to pass to the Sub-scripts)&lt;/LI&gt;&lt;LI&gt;Sub-scripts :&lt;/LI&gt;&lt;OL&gt;&lt;LI&gt;Get_Data_from SQL.jmpquery&lt;/LI&gt;&lt;LI&gt;FIlter_the_Table.jsl&lt;/LI&gt;&lt;LI&gt;Get_Charts.jsl&lt;/LI&gt;&lt;/OL&gt;&lt;/OL&gt;&lt;P&gt;Is it possible to pass arguments into different jsl scripts ? how? I tried in the Main_Script.jsl to explain all I want to do.&lt;BR /&gt;Please let me know if you have any questions and thank you for your help.&lt;BR /&gt;Regards&lt;BR /&gt;Geof&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 08:28:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-arguments-to-different-jsl-script/m-p/237394#M46875</guid>
      <dc:creator>geoff1</dc:creator>
      <dc:date>2019-12-05T08:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass arguments to different jsl script ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-arguments-to-different-jsl-script/m-p/237445#M46889</link>
      <description>&lt;P&gt;You can pass the information to other JSL scripts via global variables.&amp;nbsp; These have the prefix "::"; I add a g to indicate that they're global.&amp;nbsp; For example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;::g_my_var = "Hello";
include("my_script.jsl");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Dec 2019 14:24:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-arguments-to-different-jsl-script/m-p/237445#M46889</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2019-12-05T14:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass arguments to different jsl script ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-arguments-to-different-jsl-script/m-p/237446#M46890</link>
      <description>&lt;P&gt;If you don't want to use global variables, use the include files to define functions and only include the files once, probably at the beginning of your main file. Then you can call the user defined functions with parameters. Something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Main.jsl&lt;/P&gt;
&lt;P&gt;--------&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;include("sub1.jsl");
include("sub2.jsl");
calculator(42);
reportWriter("report title");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sub1.jsl&lt;/P&gt;
&lt;P&gt;-------&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;reportWriter = function({title},{i,j,k}, // i,j,k are local variable examples
write(title,"this is my report")
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sub2.jsl&lt;/P&gt;
&lt;P&gt;----&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;calculator = function({thresholdNumber},{x,y,z},
return(sqrt(thresholdNumber));
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 14:34:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-arguments-to-different-jsl-script/m-p/237446#M46890</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2019-12-09T14:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass arguments to different jsl script ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-pass-arguments-to-different-jsl-script/m-p/237907#M46982</link>
      <description>It works fine with gobal variables ! Thanks</description>
      <pubDate>Mon, 09 Dec 2019 14:16:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-pass-arguments-to-different-jsl-script/m-p/237907#M46982</guid>
      <dc:creator>geoff1</dc:creator>
      <dc:date>2019-12-09T14:16:39Z</dc:date>
    </item>
  </channel>
</rss>

