<?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: Adding Images to A Data Table From a Directory in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73311#M35742</link>
    <description>&lt;P&gt;RSantana, Gail's video was demonstarting how to get pics from URLs, not embedded pictures.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try the script that startw with Names default to Here(1). It was created in JMP 12.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note, if all of your pictures are of the same type then you can simplify lines 11 and 12. Suppose all your pictures are png, then you do not need line 11: _typ = word() and line 12 you can remove the Eval( EvalExpr() ) functions. I needed it for this example because the sample images have different types and in JMP 12, the open would not evaluate the variable _ext; it required that the expression be substituted then evaluated.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This would be the simplified line 12&amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;&amp;nbsp;tp = Open("$Sample_images/"||_fid[i], "png" );&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Copy and paste this into a JMP script window, run it then hover over the points. One final comment this is embedding each picture's "code" into your table column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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);

_fid = Files in Directory("$sample_images");
nr = nitems(_fid);
//Create a table
dt = New Table("demo",add rows(nr),
New Column("X", &amp;lt;&amp;lt;set Values(1::nr)), New Column("Y", &amp;lt;&amp;lt;set Values(1::nr)),
  New Column("pics", Expression)  );
 
for(i=1, i&amp;lt;=nr, i++,
  _typ = word(2,_fid[i],".");
  Eval(Eval Expr(tp = Open("$Sample_images/"||_fid[i], expr(_typ) )));	
  dt:pics[i] = new image(tp)	
);
dt:pics &amp;lt;&amp;lt; label(1);

biv = dt&amp;lt;&amp;lt; Bivariate( Y(:Y), X(:X)); &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 18 Sep 2018 01:58:03 GMT</pubDate>
    <dc:creator>gzmorgan0</dc:creator>
    <dc:date>2018-09-18T01:58:03Z</dc:date>
    <item>
      <title>Adding Images to A Data Table From a Directory</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73293#M35741</link>
      <description>&lt;P&gt;Friends, I am running JMP12 and I would like to add a series of PNG images to my data table.&amp;nbsp; I would like to do this so that I can use them as labels on a scatterplot of statistical mean-matching flags and invoke the PNG (an image of a control limit chart) by hovering the mouse over the value of each flag.&amp;nbsp; I found an SAS video by Gail Massari importing state bird pictures from a wikipedia web URL; different than him, my images are in a folder, on a local hard drive.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the instruction:&lt;/P&gt;&lt;P&gt;{"",{ newimage(open( "drive:\file path\filename.png",png))}" as a entry in each respective row but all I get in return is an "Empty()" output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to JSL scripting and I have run out of ideas.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 22:05:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73293#M35741</guid>
      <dc:creator>RSantana</dc:creator>
      <dc:date>2018-09-17T22:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Images to A Data Table From a Directory</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73311#M35742</link>
      <description>&lt;P&gt;RSantana, Gail's video was demonstarting how to get pics from URLs, not embedded pictures.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try the script that startw with Names default to Here(1). It was created in JMP 12.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note, if all of your pictures are of the same type then you can simplify lines 11 and 12. Suppose all your pictures are png, then you do not need line 11: _typ = word() and line 12 you can remove the Eval( EvalExpr() ) functions. I needed it for this example because the sample images have different types and in JMP 12, the open would not evaluate the variable _ext; it required that the expression be substituted then evaluated.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This would be the simplified line 12&amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;&amp;nbsp;tp = Open("$Sample_images/"||_fid[i], "png" );&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Copy and paste this into a JMP script window, run it then hover over the points. One final comment this is embedding each picture's "code" into your table column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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);

_fid = Files in Directory("$sample_images");
nr = nitems(_fid);
//Create a table
dt = New Table("demo",add rows(nr),
New Column("X", &amp;lt;&amp;lt;set Values(1::nr)), New Column("Y", &amp;lt;&amp;lt;set Values(1::nr)),
  New Column("pics", Expression)  );
 
for(i=1, i&amp;lt;=nr, i++,
  _typ = word(2,_fid[i],".");
  Eval(Eval Expr(tp = Open("$Sample_images/"||_fid[i], expr(_typ) )));	
  dt:pics[i] = new image(tp)	
);
dt:pics &amp;lt;&amp;lt; label(1);

biv = dt&amp;lt;&amp;lt; Bivariate( Y(:Y), X(:X)); &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Sep 2018 01:58:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73311#M35742</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2018-09-18T01:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Images to A Data Table From a Directory</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73571#M35765</link>
      <description>&lt;P&gt;This is exactly what I need and the solution is simply elegant; I am very appreciative of your time and of your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the challenge...&lt;/P&gt;&lt;P&gt;I have my PNG files in 46 individual folders and the PNG files share the same name; for example I have "&lt;STRONG&gt;graph30.png&lt;/STRONG&gt;" repeated 20-30 times but each file is saved in a different folder because it is an image of a different control limit chart.&amp;nbsp; I already have the path\filename for each as a discrete column in my data table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What would be the best way look for each &lt;STRONG&gt;graphXX.png&lt;/STRONG&gt; based on the specific path\filename already available in a contiguous column?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 20:01:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73571#M35765</guid>
      <dc:creator>RSantana</dc:creator>
      <dc:date>2018-09-18T20:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Images to A Data Table From a Directory</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73586#M35766</link>
      <description>&lt;P&gt;Is the full path in a separate column, or do you have a column for path and a column for file name?&lt;/P&gt;&lt;P&gt;Suppose it is a column named :Path. Since they are all png files then&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;tp = Open( :Path[i], "png" );&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have two columns :Dir and :Name use something like this, if there is no trailing slash for the dir name&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;tp = Open( :Dir[i] || "\" || :Name[i], "png" );&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Older versions of JMP required an eval()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;tp = Open( eval( :Dir[i] || "\" || :Name[i] )&amp;nbsp; , "png" );&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try it out before running your script , run just one line replacing i with a number to make sure you have the file pathname correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 21:05:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73586#M35766</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2018-09-18T21:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Images to A Data Table From a Directory</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73595#M35767</link>
      <description>gzmorgan, this was awesome and worked like a charm. Big thank you!!&lt;BR /&gt;&lt;BR /&gt;A final question,&lt;BR /&gt;Are journals in JMP.12 unable to display labels as you select or hover over data points in graphs?</description>
      <pubDate>Tue, 18 Sep 2018 21:43:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73595#M35767</guid>
      <dc:creator>RSantana</dc:creator>
      <dc:date>2018-09-18T21:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Images to A Data Table From a Directory</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73597#M35769</link>
      <description>&lt;P&gt;Journals are snapshots of your display.&amp;nbsp; One option is to save as a .JRP with embedded tables. Then when another opens it the underlying table and report is active.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In JMP 13 and 14 &lt;FONT color="#0000FF"&gt;Save as Interactive HTM&lt;/FONT&gt; saves the display and the labels are embedded.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 22:17:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73597#M35769</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2018-09-18T22:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Images to A Data Table From a Directory</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73600#M35771</link>
      <description>Again, thank you for your time.&lt;BR /&gt;&lt;BR /&gt;Interacting in this community has been a delightful learning experience.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Sep 2018 22:29:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/73600#M35771</guid>
      <dc:creator>RSantana</dc:creator>
      <dc:date>2018-09-18T22:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Images to A Data Table From a Directory</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/108660#M39516</link>
      <description>&lt;P&gt;Building up on this topic of using pictures (i.e. *.png) as labels on charts while using the following loop:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For( i = 1, i &amp;lt;= nr, i++,&lt;BR /&gt;tp = Open( :PNG_URL[i], "png" );&lt;BR /&gt;Latest_Report:PNGs[i] = New Image( tp )&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;Latest_Report:PNGs &amp;lt;&amp;lt; label (1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I learned that every time the OPEN command fails to find a one of the PNG files, the script stops and from that point forward, any other rows showing the folder addresses are ignored, with JMP delivering as a result "(Empty)" on each remaining cell of the table.&amp;nbsp; This means I end up with valuable information not being displayed because one row triggers a failure in the loop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the best way to override this?&lt;/P&gt;&lt;P&gt;Running the loop again only adds another column (in this case :PNG_URL 2) and delivers (as expected) the same result.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Feb 2019 18:43:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/108660#M39516</guid>
      <dc:creator>RSantana</dc:creator>
      <dc:date>2019-02-01T18:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Images to A Data Table From a Directory</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/108675#M39522</link>
      <description>&lt;P&gt;Before the open, use the function If (File Exits(), Open(); etc.; );&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= nr, i++,
 If ( File Exists( :PNG_URL[i]|| ".png" ),
   // do this only of the file is found
	tp = Open( :PNG_URL[i], "png" );
	Latest_Report:PNGs[i] = New Image( tp );
 ) // end if	 
);

Latest_Report:PNGs &amp;lt;&amp;lt; label( 1 );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Feb 2019 21:50:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-Images-to-A-Data-Table-From-a-Directory/m-p/108675#M39522</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2019-02-01T21:50:06Z</dc:date>
    </item>
  </channel>
</rss>

