<?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: Open files using contains () in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Open-files-using-contains/m-p/706272#M89089</link>
    <description>&lt;P&gt;Hi, it is working, however, is it possible to have multiple conditions on my contain() function?&lt;/P&gt;</description>
    <pubDate>Wed, 06 Dec 2023 05:27:15 GMT</pubDate>
    <dc:creator>UserID16644</dc:creator>
    <dc:date>2023-12-06T05:27:15Z</dc:date>
    <item>
      <title>Open files using contains ()</title>
      <link>https://community.jmp.com/t5/Discussions/Open-files-using-contains/m-p/706215#M89083</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am try to create a script that would go through directories to find the input file. However, some file names may have different characters.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;My input in favorite fruit would be: &lt;STRONG&gt;Orange&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Existing files from folder would be: Mark_Orange_Mango.jmp, Jane_Apple.jmp, John_Orange.jmp&lt;/P&gt;&lt;P&gt;Files that would open:&amp;nbsp;Mark_Orange_Mango.jmp and&amp;nbsp;John_Orange.jmp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I open these files using contains() or what function do I need to use? I am using JMP 15&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the piece of code I am working on:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;nw = New Window( "Favorite Fruits", &amp;lt;&amp;lt; modal(),
	lineupbox(ncol(2), spacing(5),
		
		Text Box( "Name:" ),
		teb1 = Text Edit Box( "", &amp;lt;&amp;lt;set width( 150 ) ),
		
		Text Box( "Age:" ),
		teb2 = Text Edit Box( "", &amp;lt;&amp;lt;set width( 150 ) ),

		Text Box( "Birthday:" ),
		teb3 = Text Edit Box( "", &amp;lt;&amp;lt;set width( 150 ) ),
		
		Text Box( "Favorite Fruit:" ),
		teb4 = Text Edit Box( "", &amp;lt;&amp;lt;set width( 150 ) ),
	),
	Button Box( "OK", 
		name = teb1 &amp;lt;&amp;lt; get text ();
		age = teb2 &amp;lt;&amp;lt; get text ();
		bday = teb3 &amp;lt;&amp;lt; get text ();
		fruit = teb4 &amp;lt;&amp;lt; get text ();	
	),
);


/* ----- opening the files ----- */

path = "C:\Users\Desktop" || Char (name) || "\" || Char (bday);

files = Files in Directory (path);

For (j=1, j&amp;lt;= N Items (files), j++,
	If (Contains (fruit[j], ".jmp"), // Open file that contains the input from text box
	...
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Dec 2023 03:48:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-files-using-contains/m-p/706215#M89083</guid>
      <dc:creator>UserID16644</dc:creator>
      <dc:date>2023-12-06T03:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Open files using contains ()</title>
      <link>https://community.jmp.com/t5/Discussions/Open-files-using-contains/m-p/706265#M89087</link>
      <description>&lt;P&gt;See if this works for you&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;nw = New Window( "Favorite Fruits",
	&amp;lt;&amp;lt;modal(),
	Lineup Box( N Col( 2 ), spacing( 5 ), 
		
		Text Box( "Name:" ),
		teb1 = Text Edit Box( "", &amp;lt;&amp;lt;set width( 150 ) ), 
		
		Text Box( "Age:" ),
		teb2 = Text Edit Box( "", &amp;lt;&amp;lt;set width( 150 ) ), 

		Text Box( "Birthday:" ),
		teb3 = Text Edit Box( "", &amp;lt;&amp;lt;set width( 150 ) ), 
		
		Text Box( "Favorite Fruit:" ),
		teb4 = Text Edit Box( "", &amp;lt;&amp;lt;set width( 150 ) ),

	),
	Button Box( "OK",
		name = teb1 &amp;lt;&amp;lt; get text();
		age = teb2 &amp;lt;&amp;lt; get text();
		bday = teb3 &amp;lt;&amp;lt; get text();
		fruit = teb4 &amp;lt;&amp;lt; get text();
	),

);

/* ----- opening the files ----- */

path = "C:\Users\Desktop" || Char( name ) || "\" || Char( bday );

files = Files In Directory();

For( i = N Items( files ), i &amp;gt;= 1, i--,
	If( Word( -1, files[i], "." ) != "jmp",
		Remove From( files, i, 1 )
	)
);

If( N Items( Files ) &amp;gt; 0,
	tableList = {};
	For( j = 1, j &amp;lt;= N Items( files ), j++,
		If( Contains( files[j], fruit ) &amp;gt; 0, // Open file that contains the input from text box
			dd = Open( path || "/" || files[j] );
			Insert Into( tableList, dd );
		)
	);
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Dec 2023 04:50:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-files-using-contains/m-p/706265#M89087</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-12-06T04:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: Open files using contains ()</title>
      <link>https://community.jmp.com/t5/Discussions/Open-files-using-contains/m-p/706272#M89089</link>
      <description>&lt;P&gt;Hi, it is working, however, is it possible to have multiple conditions on my contain() function?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 05:27:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-files-using-contains/m-p/706272#M89089</guid>
      <dc:creator>UserID16644</dc:creator>
      <dc:date>2023-12-06T05:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Open files using contains ()</title>
      <link>https://community.jmp.com/t5/Discussions/Open-files-using-contains/m-p/706296#M89093</link>
      <description>&lt;P&gt;It can be as complex as you want it to be&lt;/P&gt;
&lt;PRE&gt;If(&lt;BR /&gt;(Contains( files[j], fruit ) &amp;amp; Contains( files[j], "Good Luck" )) |&lt;BR /&gt;Contains( files[j], "Special" ),&lt;BR /&gt;dd = Open( path || "/" || files[j] )&lt;BR /&gt;)&lt;/PRE&gt;
&lt;P&gt;I strongly suggest you take some time to read the Scripting Guide.&amp;nbsp; It will make your journey into scripting far more pleasent.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 07:39:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-files-using-contains/m-p/706296#M89093</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-12-06T07:39:58Z</dc:date>
    </item>
  </channel>
</rss>

