<?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 can I loop through multiple csv files and select them base on specific file name? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805110#M98314</link>
    <description>&lt;P&gt;You could take the next step as well and upgrade to JMP18 -&amp;nbsp; with the option to use a File List in MultiFileImport.&lt;/P&gt;&lt;P&gt;For some cases, this will speed up the data import by orders of magnitude!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;y= Transform each ({fn}, y, mypath || fn);
Eval(Eval Expr (Multiple File Import(
	&amp;lt;&amp;lt;Set Use File List( 1 ),
	&amp;lt;&amp;lt;Set File List( Expr(y))
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;At the moment, Filelist +&amp;nbsp;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;MultiFileImport&lt;/FONT&gt; needs the complicate &lt;FONT face="courier new,courier"&gt;Eval(Eval Expr(... Expr() ...))&lt;/FONT&gt;.&lt;BR /&gt;This will get fixed in a future release of JMP.&lt;/P&gt;</description>
    <pubDate>Tue, 15 Oct 2024 10:53:18 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2024-10-15T10:53:18Z</dc:date>
    <item>
      <title>How can I loop through multiple csv files and select them base on specific file name?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805071#M98308</link>
      <description>&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;path = "/users/BOT/Test_files/";
Set File Search Path( mypath );

// filter out all csv files in the path that contains "Pass" &amp;amp;&amp;amp;  Not contains "Conditional_Pass" or "Fail" in file name
y = Files In Directory( mypath );

For( i = N Items( y ), i &amp;gt; 0, i--,
	If( (Ends With( y[i], ".csv" ) &amp;amp; Contains( y[i], "Pass" ) &amp;amp; Not( Contains( y[i], "Conditional_Pass" ) ) &amp;amp; Not( Contains( y[i], "Fail" ) )),
	,
		Remove From( y, i )
	)
);
n = N Items( y );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Keep getting below error as screenshot, is it because the &lt;U&gt;Files In Directory()&lt;/U&gt; function being deprecated?&lt;BR /&gt;&lt;BR /&gt;Funny thing is above codes used to work for JMP16, below error pops out after I upgrade to JMP17 yesterday.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bin_JMPspace_0-1728650929990.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69031i7C2A80A9D6608113/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bin_JMPspace_0-1728650929990.png" alt="Bin_JMPspace_0-1728650929990.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 12:53:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805071#M98308</guid>
      <dc:creator>Bin_JMPspace</dc:creator>
      <dc:date>2024-10-11T12:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can I loop through multiple csv files and select them base on specific file name?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805081#M98309</link>
      <description>&lt;P&gt;You are most likely getting that error as you are removing same list you are looping over. For this type of filtering I would suggest using Filter Each instead of For loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, have you tried using &lt;A href="https://www.jmp.com/support/help/en/18.0/#page/jmp/import-multiple-files.shtml#" target="_blank" rel="noopener"&gt;Multiple File Import&lt;/A&gt;?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 12:57:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805081#M98309</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-10-11T12:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can I loop through multiple csv files and select them base on specific file name?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805109#M98313</link>
      <description>&lt;P&gt;please check &lt;FONT face="courier new,courier"&gt;path&lt;/FONT&gt; vs. &lt;FONT face="courier new,courier"&gt;mypath&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;besides that you could use &lt;FONT face="courier new,courier"&gt;Filter Each&lt;/FONT&gt; instead of the &lt;FONT face="courier new,courier"&gt;for&lt;/FONT&gt; loop:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//path = "/users/BOT/Test_files/";
mypath = "/users/BOT/Test_files/";

y = Files In Directory( mypath );

y = filter each({fn}, y, Ends With( fn, ".csv" ) &amp;amp; Contains( fn, "Pass" ) &amp;amp; Not( Contains( fn, "Conditional_Pass" ) ) &amp;amp; Not( Contains( fn, "Fail" ) ) )&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Oct 2024 13:26:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805109#M98313</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-10-11T13:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can I loop through multiple csv files and select them base on specific file name?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805110#M98314</link>
      <description>&lt;P&gt;You could take the next step as well and upgrade to JMP18 -&amp;nbsp; with the option to use a File List in MultiFileImport.&lt;/P&gt;&lt;P&gt;For some cases, this will speed up the data import by orders of magnitude!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;y= Transform each ({fn}, y, mypath || fn);
Eval(Eval Expr (Multiple File Import(
	&amp;lt;&amp;lt;Set Use File List( 1 ),
	&amp;lt;&amp;lt;Set File List( Expr(y))
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;At the moment, Filelist +&amp;nbsp;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;MultiFileImport&lt;/FONT&gt; needs the complicate &lt;FONT face="courier new,courier"&gt;Eval(Eval Expr(... Expr() ...))&lt;/FONT&gt;.&lt;BR /&gt;This will get fixed in a future release of JMP.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 10:53:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805110#M98314</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-10-15T10:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: How can I loop through multiple csv files and select them base on specific file name?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805420#M98365</link>
      <description>&lt;P&gt;I think you have a data table open with a column named Y. JSL is trying to use the table's column, which is not what you want. Either close the table, or change the name in either the table or the script, or use scoping to tell JMP which you mean.&lt;/P&gt;
&lt;P&gt;This example is starting JMP fresh before Y is in any namespace.&lt;/P&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="capture.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69094iFCE457593A1AEFCF/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture.png" alt="capture.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/1893"&gt;@Audrey_Shull&lt;/a&gt;&amp;nbsp; - That error dialog would be improved 100% if it named the table the variable is coming from.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 18:52:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805420#M98365</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2024-10-14T18:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I loop through multiple csv files and select them base on specific file name?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805562#M98387</link>
      <description>&lt;P&gt;Thanks Craige, yes I found my bug a day ago and solved it, just like your description.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 10:01:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805562#M98387</guid>
      <dc:creator>Bin_JMPspace</dc:creator>
      <dc:date>2024-10-15T10:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can I loop through multiple csv files and select them base on specific file name?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805563#M98388</link>
      <description>&lt;P&gt;Thanks hog, the filter each function also gives me some inspiration.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 10:02:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805563#M98388</guid>
      <dc:creator>Bin_JMPspace</dc:creator>
      <dc:date>2024-10-15T10:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I loop through multiple csv files and select them base on specific file name?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805564#M98389</link>
      <description>&lt;P&gt;Hey jthi, thank you.&lt;BR /&gt;Agree the Multi File Import is a good way to parse the files, faster than my current method.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 10:03:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-loop-through-multiple-csv-files-and-select-them-base/m-p/805564#M98389</guid>
      <dc:creator>Bin_JMPspace</dc:creator>
      <dc:date>2024-10-15T10:03:42Z</dc:date>
    </item>
  </channel>
</rss>

