<?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: Subset Table Keeps Showing Old Rows – How to Clear Memory Between Runs? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/915133#M107544</link>
    <description>&lt;P&gt;I'm not sure why you are creating two subsets in this case&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

path = Convert File Path("$SAMPLE_DATA/", windows);
files = Files In Directory(path);

targetfiles = {"Big Class.jmp", "Probe.jmp"};

files_of_interest = Filter Each({target}, targetfiles,
	Contains(files, target);
);



create_filtered_table = function({dt, values, tablename}, {Default Local},
	rows_of_interest = dt &amp;lt;&amp;lt; Get Rows Where(Contains(values, :Filename));
		
	dt_res = dt &amp;lt;&amp;lt; Subset(Rows(rows_of_interest), Selected Columns(0), Output Table(tablename), Invisible);
	
	return(dt_res);
);


dt1 = New Table("table1",
	Add Rows(6),
	Compress File When Saved(1),
	New Column("Filename",
		Character,
		"Nominal",
		Compact(),
		Set Values({"Big Class.jmp", "a", "b", "c", "Big Class.jmp"})
	)
);

dt2 = New Table("table1",
	Add Rows(6),
	Compress File When Saved(1),
	New Column("Filename",
		Character,
		"Nominal",
		Compact(),
		Set Values({"Probe.jmp", "a", "b", "c", "Big Class.jmp"})
	)
);



dt_res1 = create_filtered_table(dt1, files_of_interest, "Table1");
dt_res2 = create_filtered_table(dt2, files_of_interest, "Table2");
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 25 Nov 2025 05:20:10 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2025-11-25T05:20:10Z</dc:date>
    <item>
      <title>Subset Table Keeps Showing Old Rows – How to Clear Memory Between Runs?</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914656#M107488</link>
      <description>&lt;P data-start="348" data-end="489"&gt;I’m working on a JMP JSL script where I filter tables based on a &lt;STRONG data-start="413" data-end="445"&gt;user-provided list of values&lt;/STRONG&gt;. I create filtered tables using &lt;CODE data-start="478" data-end="486"&gt;Subset&lt;/CODE&gt;.&lt;/P&gt;
&lt;P data-start="491" data-end="523"&gt;The issue I’m running into is:&lt;/P&gt;
&lt;OL data-start="525" data-end="951"&gt;
&lt;LI data-start="525" data-end="594"&gt;
&lt;P data-start="528" data-end="594"&gt;On the &lt;STRONG data-start="535" data-end="548"&gt;first run&lt;/STRONG&gt;, the filtered table shows the correct rows.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="595" data-end="748"&gt;
&lt;P data-start="598" data-end="748"&gt;On the &lt;STRONG data-start="605" data-end="619"&gt;second run&lt;/STRONG&gt;, if I input a new list, the filtered table &lt;STRONG data-start="663" data-end="715"&gt;sometimes still shows rows from the previous run&lt;/STRONG&gt;, or combines old and new rows.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="749" data-end="951"&gt;
&lt;P data-start="752" data-end="951"&gt;I’m using &lt;CODE data-start="762" data-end="788"&gt;Names Default To Here(1)&lt;/CODE&gt; and &lt;CODE data-start="793" data-end="810"&gt;Clear Symbols()&lt;/CODE&gt; at the end of the script, but that &lt;STRONG data-start="846" data-end="896"&gt;does not fully clear the table from JMP memory&lt;/STRONG&gt;, so &lt;CODE data-start="901" data-end="909"&gt;Subset&lt;/CODE&gt; seems to retain references to old rows.&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P data-start="953" data-end="975"&gt;Is there a recommended way in JMP to &lt;STRONG data-start="1392" data-end="1430"&gt;completely clear memory references&lt;/STRONG&gt; for tables before creating new subsets?&lt;/P&gt;
&lt;P data-start="953" data-end="975"&gt;hows to make &lt;CODE data-start="1607" data-end="1615"&gt;Subset&lt;/CODE&gt; filtering &lt;STRONG data-start="1626" data-end="1661"&gt;repeatable across multiple runs&lt;/STRONG&gt; without old data showing up?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Nov 2025 09:38:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914656#M107488</guid>
      <dc:creator>zetaVagabond1</dc:creator>
      <dc:date>2025-11-21T09:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Table Keeps Showing Old Rows – How to Clear Memory Between Runs?</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914666#M107489</link>
      <description>&lt;P&gt;Can you provide example of your script?&amp;nbsp;If you are using subset correctly, it won't show "old rows".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Nov 2025 10:05:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914666#M107489</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-11-21T10:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Table Keeps Showing Old Rows – How to Clear Memory Between Runs?</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914674#M107491</link>
      <description>&lt;P&gt;could you please share a simplified version of your&amp;nbsp; code - &lt;STRONG&gt;as short as possible&lt;/STRONG&gt;.&lt;BR /&gt;... starting with loading a data table , e.g.&lt;/P&gt;
&lt;PRE class="language-jsl"&gt;&lt;CODE&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A class="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa" href="https://community.jmp.com/t5/Getting-Started/Getting-fast-helpful-answers-to-your-questions/m-p/28583#U28583" target="_blank" rel="noopener"&gt;Getting fast helpful answers to your questions&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A class="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa" href="https://community.jmp.com/t5/Discussions/Getting-correct-answers-to-correct-questions-quickly/m-p/550097#U550097" target="_blank" rel="noopener"&gt;Getting correct answers to correct questions quickly&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Nov 2025 11:56:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914674#M107491</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-11-21T11:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Table Keeps Showing Old Rows – How to Clear Memory Between Runs?</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914675#M107492</link>
      <description>&lt;P&gt;Most of such timing issues can be fixed via &lt;FONT face="courier new,courier"&gt;wait(0).&lt;BR /&gt;&lt;/FONT&gt;Just add it after the subset command - and maybe another one before the subset command.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Nov 2025 11:56:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914675#M107492</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-11-21T11:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Table Keeps Showing Old Rows – How to Clear Memory Between Runs?</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914888#M107508</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;FilterByValueList = Function({sourceTbl, valueList, outName},
    tempTbl = sourceTbl &amp;lt;&amp;lt; Duplicate Window();
    tempTbl &amp;lt;&amp;lt; Clear Row States;

    For(i = 1, i &amp;lt;= N Items(valueList), i++,
        val = valueList[i];
        tempTbl &amp;lt;&amp;lt; Row Selection(
            Select Where(:Batch Number == val, Current Selection("Extend"))
        );
    );

    resultTbl = tempTbl &amp;lt;&amp;lt; Subset(
        Selected Rows(1),
        Output Table Name(outName),
        Invisible
    );

    Return(resultTbl);
);

// Example usage:

RunDataSubset = FilterByValueList(DataRuns, SelectedValues, "RunDataSubset");
MetaSubset    = FilterByValueList(MetaRuns, SelectedValues, "MetaSubset");
//SelectedValues is a list &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Nov 2025 02:52:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914888#M107508</guid>
      <dc:creator>zetaVagabond1</dc:creator>
      <dc:date>2025-11-24T02:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Table Keeps Showing Old Rows – How to Clear Memory Between Runs?</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914889#M107509</link>
      <description>&lt;P&gt;Thanks. I missed pasting the code , here is the snippet for reference ; reading the input list values via a window and then following :&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Directory path
pathDir = "J:\jmp-data\raw_data";
fileList = Files In Directory(pathDir);
Show(fileList);



selectedValues = {};
For(i = 1, i &amp;lt;= N Items(fileList), i++,
	For(j = 1, j &amp;lt;= N Items(targetSource), j++,
		If(Contains(fileList[i], targetSource[j]),
			Insert Into(selectedValues, targetSource[j]);
			Break();
		);
	);
);

countValues = N Items(selectedValues);
Show(selectedValues);

FilterByValueList = Function({sourceTbl, valueList, outName},
    tempTbl = sourceTbl &amp;lt;&amp;lt; Duplicate Window();
    tempTbl &amp;lt;&amp;lt; Clear Row States;

    For(i = 1, i &amp;lt;= N Items(valueList), i++,
        val = valueList[i];
        tempTbl &amp;lt;&amp;lt; Row Selection(
            Select Where(:Batch Number == val, Current Selection("Extend"))
        );
    );

    resultTbl = tempTbl &amp;lt;&amp;lt; Subset(
        Selected Rows(1),
        Output Table Name(outName),
        Invisible
    );

    Return(resultTbl);
);

// Example usage:

RunDataSubset = FilterByValueList(DataRuns, SelectedValues, "RunDataSubset");
MetaSubset    = FilterByValueList(MetaRuns, SelectedValues, "MetaSubset");

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;I also found the window that is being created to take user input, has global variables and that could be the reason for old data to show up:&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;                    SelectedValuestext = Select_Values_test0 &amp;lt;&amp;lt;get text;
                    SelectedValuesText0 = {};
					i=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;SelectedValuesText0 = {}; -&amp;nbsp; still has nothing so whenever I run the code again it should take new user input values if they are diff.&amp;nbsp;&lt;BR /&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Nov 2025 04:00:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914889#M107509</guid>
      <dc:creator>zetaVagabond1</dc:creator>
      <dc:date>2025-11-24T04:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Table Keeps Showing Old Rows – How to Clear Memory Between Runs?</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914897#M107511</link>
      <description>&lt;P&gt;Where does the &amp;lt;&amp;lt; Duplicate Window() come from and what is it supposed to do?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1763962791739.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/87583iB5D7E2D086E42DEE/image-size/large?v=v2&amp;amp;px=999" role="button" title="jthi_1-1763962791739.png" alt="jthi_1-1763962791739.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;JSL does have quite a lot of powerful functions you could use instead of using For() everywhere. You can go over lists faster using Filter Each, Transform Each, For Each and you can most likely do the selection without loop using Contains().&lt;/P&gt;</description>
      <pubDate>Mon, 24 Nov 2025 05:40:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/914897#M107511</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-11-24T05:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Table Keeps Showing Old Rows – How to Clear Memory Between Runs?</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/915116#M107541</link>
      <description>&lt;P&gt;I realised duplicate window doesn't exist, so I went ahead with creating the dt like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;    dt = inputTable &amp;lt;&amp;lt; Subset(All Rows, All Columns,Output Table("dt"),Invisible);&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;I&amp;nbsp;do&amp;nbsp;not&amp;nbsp;know&amp;nbsp;if&amp;nbsp;there's&amp;nbsp;an&amp;nbsp;easier&amp;nbsp;way.&amp;nbsp;&lt;BR /&gt;a&amp;nbsp;=&amp;nbsp;b&amp;nbsp; &amp;nbsp;doesn't&amp;nbsp;work. for data table , I was looking for copy table(), i found copy file(),&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also creating this way requires the table to be closed everytime. I found that easier to deal and deliver.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&lt;BR /&gt;calcTable = Try( Data Table("KPI"), Empty() );
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2025 02:50:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/915116#M107541</guid>
      <dc:creator>zetaVagabond1</dc:creator>
      <dc:date>2025-11-25T02:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Table Keeps Showing Old Rows – How to Clear Memory Between Runs?</title>
      <link>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/915133#M107544</link>
      <description>&lt;P&gt;I'm not sure why you are creating two subsets in this case&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

path = Convert File Path("$SAMPLE_DATA/", windows);
files = Files In Directory(path);

targetfiles = {"Big Class.jmp", "Probe.jmp"};

files_of_interest = Filter Each({target}, targetfiles,
	Contains(files, target);
);



create_filtered_table = function({dt, values, tablename}, {Default Local},
	rows_of_interest = dt &amp;lt;&amp;lt; Get Rows Where(Contains(values, :Filename));
		
	dt_res = dt &amp;lt;&amp;lt; Subset(Rows(rows_of_interest), Selected Columns(0), Output Table(tablename), Invisible);
	
	return(dt_res);
);


dt1 = New Table("table1",
	Add Rows(6),
	Compress File When Saved(1),
	New Column("Filename",
		Character,
		"Nominal",
		Compact(),
		Set Values({"Big Class.jmp", "a", "b", "c", "Big Class.jmp"})
	)
);

dt2 = New Table("table1",
	Add Rows(6),
	Compress File When Saved(1),
	New Column("Filename",
		Character,
		"Nominal",
		Compact(),
		Set Values({"Probe.jmp", "a", "b", "c", "Big Class.jmp"})
	)
);



dt_res1 = create_filtered_table(dt1, files_of_interest, "Table1");
dt_res2 = create_filtered_table(dt2, files_of_interest, "Table2");
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Nov 2025 05:20:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Subset-Table-Keeps-Showing-Old-Rows-How-to-Clear-Memory-Between/m-p/915133#M107544</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-11-25T05:20:10Z</dc:date>
    </item>
  </channel>
</rss>

