<?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: Run script on different tables in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Run-script-on-different-tables/m-p/745169#M92499</link>
    <description>&lt;P&gt;You can get the table list using &lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/row-functions-2.shtml?os=win&amp;amp;source=application#ww7220797" target="_blank" rel="noopener"&gt;Get Data Table List();&lt;/A&gt;, you can then loop over this list by using &lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/conditional-and-logical-functions.shtml?os=win&amp;amp;source=application#ww10169967" target="_blank" rel="noopener"&gt;For Each()&lt;/A&gt; and perform actions inside it. You could turn whatever you do inside the loop into expression using &lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/expression-functions.shtml?os=win&amp;amp;source=application#ww4985167" target="_self"&gt;Expr()&lt;/A&gt; or to a function with &lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/programming-functions.shtml?os=win&amp;amp;source=application#ww5013741" target="_self"&gt;Function()&lt;/A&gt; to make the code a bit more clean&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);
Open("$SAMPLE_DATA/Big Class.jmp");
Open("$SAMPLE_DATA/Cars.jmp");

For Each({dt}, Get Data Table List(),
	dtname = dt &amp;lt;&amp;lt; get name;
	show(dtname);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Depending how you open your tables / get them, you most likely already have references to those and you could just use them instead of Get Data Table List().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Scripting Index (from JMP Help menu) and &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&lt;/A&gt; have a lot of information and documentation regarding JMP scriptig, I suggest checking those out.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Apr 2024 09:51:51 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-04-08T09:51:51Z</dc:date>
    <item>
      <title>Run script on different tables</title>
      <link>https://community.jmp.com/t5/Discussions/Run-script-on-different-tables/m-p/745165#M92496</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a script that splits text from one column to serval columns, deletes some, gives names, and changes data type.&lt;/P&gt;
&lt;P&gt;the script includes the table name,&lt;/P&gt;
&lt;P&gt;I want to use this script on other tables without changing table names for different files.&lt;/P&gt;
&lt;P&gt;all the tables I use are in the same format except for table names.&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Text to columns
Data Table(
	"TM1_CTW RPT+TPT x10.0_TU_Defualt_6050_01_Surface_TM1_CTW RPT+TPT x10.0_TU_Defualt_6293_04_Surface"
) &amp;lt;&amp;lt; Text to Columns( columns( :File Name ), Delimiters( "_" ) );
 
 
// Delete columns
Data Table(
	"TM1_CTW RPT+TPT x10.0_TU_Defualt_6050_01_Surface_TM1_CTW RPT+TPT x10.0_TU_Defualt_6293_04_Surface"
) &amp;lt;&amp;lt; Delete Columns( :File Name 1, :File Name 2, :File Name 3, :File Name 4, :File Name 7 );
 
 
// Change column info: Scan
Data Table(
	"TM1_CTW RPT+TPT x10.0_TU_Defualt_6050_01_Surface_TM1_CTW RPT+TPT x10.0_TU_Defualt_6293_04_Surface"
):File Name 5 &amp;lt;&amp;lt; Data Type( Numeric ) &amp;lt;&amp;lt; Set Name( "Scan" ) &amp;lt;&amp;lt; Set Modeling Type( "Ordinal" ) &amp;lt;&amp;lt;
Set Field Width( 12 );
 
 
// Change column info: Wafer
Data Table(
	"TM1_CTW RPT+TPT x10.0_TU_Defualt_6050_01_Surface_TM1_CTW RPT+TPT x10.0_TU_Defualt_6293_04_Surface"
):File Name 6 &amp;lt;&amp;lt; Data Type( Numeric ) &amp;lt;&amp;lt; Set Name( "Wafer" ) &amp;lt;&amp;lt; Set Modeling Type( "Ordinal" ) &amp;lt;&amp;lt;
Set Field Width( 12 );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ohad_s_0-1712567249491.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/63152iC71B08AC2FCFAE38/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ohad_s_0-1712567249491.png" alt="Ohad_s_0-1712567249491.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2024 09:58:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Run-script-on-different-tables/m-p/745165#M92496</guid>
      <dc:creator>Ohad_s</dc:creator>
      <dc:date>2024-04-08T09:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Run script on different tables</title>
      <link>https://community.jmp.com/t5/Discussions/Run-script-on-different-tables/m-p/745169#M92499</link>
      <description>&lt;P&gt;You can get the table list using &lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/row-functions-2.shtml?os=win&amp;amp;source=application#ww7220797" target="_blank" rel="noopener"&gt;Get Data Table List();&lt;/A&gt;, you can then loop over this list by using &lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/conditional-and-logical-functions.shtml?os=win&amp;amp;source=application#ww10169967" target="_blank" rel="noopener"&gt;For Each()&lt;/A&gt; and perform actions inside it. You could turn whatever you do inside the loop into expression using &lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/expression-functions.shtml?os=win&amp;amp;source=application#ww4985167" target="_self"&gt;Expr()&lt;/A&gt; or to a function with &lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/programming-functions.shtml?os=win&amp;amp;source=application#ww5013741" target="_self"&gt;Function()&lt;/A&gt; to make the code a bit more clean&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);
Open("$SAMPLE_DATA/Big Class.jmp");
Open("$SAMPLE_DATA/Cars.jmp");

For Each({dt}, Get Data Table List(),
	dtname = dt &amp;lt;&amp;lt; get name;
	show(dtname);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Depending how you open your tables / get them, you most likely already have references to those and you could just use them instead of Get Data Table List().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Scripting Index (from JMP Help menu) and &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&lt;/A&gt; have a lot of information and documentation regarding JMP scriptig, I suggest checking those out.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2024 09:51:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Run-script-on-different-tables/m-p/745169#M92499</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-04-08T09:51:51Z</dc:date>
    </item>
  </channel>
</rss>

