<?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 JMP file Using Variable and Wildcard in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Open-JMP-file-Using-Variable-and-Wildcard/m-p/8569#M8563</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks MS,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That works great.&amp;nbsp; I was wondering how with the code provided it managed to grab the correct JMP files even though many other files with the siteid prefix existed.&amp;nbsp; Turns out it was luck that the correct file I want to open was the first listed with the siteid prefix.&amp;nbsp; So, to ensure that I opened the JMP file in the event that the first file corresponding to siteid in the list wasn't a JMP file, I added the following Ends With code.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For( i = 1, i &amp;lt;= n, i++,&lt;/P&gt;&lt;P&gt;&amp;nbsp; If( AND( Starts With( files&lt;I&gt;, siteid ), Ends With( files&lt;I&gt;, "jmp" ) ),&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; filename = files&lt;I&gt;;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Break();&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Learned a lot from this little exercise.&amp;nbsp; Thanks again for your helping out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 May 2014 22:10:25 GMT</pubDate>
    <dc:creator>terapin</dc:creator>
    <dc:date>2014-05-13T22:10:25Z</dc:date>
    <item>
      <title>Open JMP file Using Variable and Wildcard</title>
      <link>https://community.jmp.com/t5/Discussions/Open-JMP-file-Using-Variable-and-Wildcard/m-p/8567#M8561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After prompting the user to select a text file, the file is opened and a variable is created based on the site name contained in this text data filename as follows&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;dt.rawdata = Open (&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Pick File( ......&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create string that is filename&lt;/P&gt;&lt;P&gt;dtname = dt.rawdata &amp;lt;&amp;lt; Get Name;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create variable called siteid that removes just the site name from the filename&lt;/P&gt;&lt;P&gt;If( Word( 1, dtname, "_" ) == "UC",&lt;/P&gt;&lt;P&gt;&amp;nbsp; siteid = "UC_" || Word( 2, dtname, "_" ),&lt;/P&gt;&lt;P&gt;&amp;nbsp; siteid = Word( 1, dtname, "_" )&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'm struggling with now is how to open a JMP data file whose name contains the siteid just determined.&amp;nbsp; There are about 40 .xls and .jmp data files in a directory and I'm trying to open the only JMP file that contains siteid in the filename as follows&lt;/P&gt;&lt;P&gt;where ? is a wildcard for the text string that follows LTEM Data.&amp;nbsp; The filenames follow the format siteid LTEM Data, yyyy - YTD.jmp where yyyy refers to starting year and varies depending on the site id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dt.metplots = Open( &lt;/P&gt;&lt;P&gt;&amp;nbsp; "$dir_metplots/" || siteid || " LTEM Data?" || ".jmp"&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a wildcard that can be used for this or is there some other clever way to accomplish this?&amp;nbsp; Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 20:29:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-JMP-file-Using-Variable-and-Wildcard/m-p/8567#M8561</guid>
      <dc:creator>terapin</dc:creator>
      <dc:date>2014-05-13T20:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Open JMP file Using Variable and Wildcard</title>
      <link>https://community.jmp.com/t5/Discussions/Open-JMP-file-Using-Variable-and-Wildcard/m-p/8568#M8562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think wildcards can be used here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe this approach works for you (first commands just copied from above):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;dt.rawdata &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #032ce4;"&gt;Open&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;SPAN style="color: #032ce4;"&gt;Pick File&lt;/SPAN&gt;&lt;STRONG&gt;())&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier; color: #008f00;"&gt;// Create string that is filename&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;dtname &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; dt.rawdata &lt;SPAN style="color: #011993;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;Get Name&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier; color: #008f00;"&gt;// Create variable called siteid that removes just the site name from the filename&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;&lt;SPAN style="color: #032ce4;"&gt;If&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;SPAN style="color: #032ce4;"&gt;Word&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; dtname&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #942193;"&gt;"_"&lt;/SPAN&gt; &lt;STRONG&gt;)&lt;/STRONG&gt; &lt;SPAN style="color: #011993;"&gt;==&lt;/SPAN&gt; &lt;SPAN style="color: #942193;"&gt;"UC"&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;&amp;nbsp; siteid &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #942193;"&gt;"UC_"&lt;/SPAN&gt; &lt;SPAN style="color: #011993;"&gt;||&lt;/SPAN&gt; &lt;SPAN style="color: #032ce4;"&gt;Word&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; dtname&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #942193;"&gt;"_"&lt;/SPAN&gt; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;&amp;nbsp; siteid &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #032ce4;"&gt;Word&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; dtname&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #942193;"&gt;"_"&lt;/SPAN&gt; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier; color: #008f00;"&gt;// Create list of files in directory&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier; color: #942193;"&gt;&lt;SPAN style="color: #000000;"&gt;path &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;"$dir_metplots/"&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier; color: #032ce4;"&gt;&lt;SPAN style="color: #000000;"&gt;files &lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;Files In Directory&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; path &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;n &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #032ce4;"&gt;N Items&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; files &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier; color: #008f00;"&gt;// Get name of the file that starts with current siteid&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;&lt;SPAN style="color: #032ce4;"&gt;For&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; i &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; i &lt;SPAN style="color: #011993;"&gt;&amp;lt;=&lt;/SPAN&gt; n&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; i&lt;SPAN style="color: #011993;"&gt;++,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;&amp;nbsp; &lt;SPAN style="color: #032ce4;"&gt;If&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;SPAN style="color: #032ce4;"&gt;Starts With&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; files&lt;STRONG&gt;[&lt;/STRONG&gt;i&lt;STRONG&gt;]&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt; siteid &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;&amp;nbsp; filename &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; files&lt;STRONG&gt;[&lt;/STRONG&gt;i&lt;STRONG&gt;]&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier; color: #032ce4;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp; &lt;/SPAN&gt;Break&lt;SPAN style="color: #000000;"&gt;&lt;STRONG&gt;()&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;&amp;nbsp; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier; color: #008f00;"&gt;// Open file&lt;/P&gt;&lt;P style="font-size: 15px; font-family: Courier;"&gt;dt.metplots &lt;SPAN style="color: #011993;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #032ce4;"&gt;Open&lt;/SPAN&gt;&lt;STRONG&gt;(&lt;/STRONG&gt; path &lt;SPAN style="color: #011993;"&gt;||&lt;/SPAN&gt; filename &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;SPAN style="color: #011993;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 21:24:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-JMP-file-Using-Variable-and-Wildcard/m-p/8568#M8562</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2014-05-13T21:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Open JMP file Using Variable and Wildcard</title>
      <link>https://community.jmp.com/t5/Discussions/Open-JMP-file-Using-Variable-and-Wildcard/m-p/8569#M8563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks MS,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That works great.&amp;nbsp; I was wondering how with the code provided it managed to grab the correct JMP files even though many other files with the siteid prefix existed.&amp;nbsp; Turns out it was luck that the correct file I want to open was the first listed with the siteid prefix.&amp;nbsp; So, to ensure that I opened the JMP file in the event that the first file corresponding to siteid in the list wasn't a JMP file, I added the following Ends With code.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For( i = 1, i &amp;lt;= n, i++,&lt;/P&gt;&lt;P&gt;&amp;nbsp; If( AND( Starts With( files&lt;I&gt;, siteid ), Ends With( files&lt;I&gt;, "jmp" ) ),&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; filename = files&lt;I&gt;;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Break();&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Learned a lot from this little exercise.&amp;nbsp; Thanks again for your helping out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 22:10:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Open-JMP-file-Using-Variable-and-Wildcard/m-p/8569#M8563</guid>
      <dc:creator>terapin</dc:creator>
      <dc:date>2014-05-13T22:10:25Z</dc:date>
    </item>
  </channel>
</rss>

