I can see how to readily create an image file from a graph. Is it possible to do the same with a data table?
Hi @SpannerHead,
Gotcha, let's try it a different way:
pickdir=pick directory();//pick where you want your file to go dt=current data table(); //clear selections - if the selected column is left it will only bring that column into the journal dt<<clear select(); dt << Clear Column Selection(); journaltext = (Window( dt )) << getjournal; journalbox = Journal Box( journaltext ); image = journalbox << getpicture; //nw=New Window( "image", image );//opening the journal so you can see the appearance-this line isnt needed image<< Save Image( saveloc=pickdir||"Journalgraph.png", "png" ); open(saveloc);
Thanks,
Ben
Looks like I can do this from Journal. Just need a means to make the code generic to any table?
Hi @SpannerHead ,
Here's a generic JSL that will work with any table by sending it over to a journal and saving as you've requested. I've added a prompt at the start so you can pick where you want the file to save.
pickdir=pick directory();//pick where you want your file to go dt=current data table(); nw = New Window( "data table journal",<<journal, placeholder_VLB=v list box()); placeholder_VLB<<append(data table box(dt)); image=nw<<get picture; image<< Save Image( saveloc=pickdir||"Journalgraph.png", "png" ); open(saveloc);
Clever script! Only remaining issue is that the resulting Journal loses all it's formatting from the original table. The original had a lot of colouration indicating pass or fail.
You can also << get as report + << get picture (<< Get As Report can be helpful in many other places also not just here)
Names Default To Here(1); dt = open("$SAMPLE_DATA/Big Class.jmp"); r = dt << Get As Report; img = r << Get Picture; img << Save Image("$TEMP/pic.png", "png"); Open("$TEMP/pic.png");
If you wish to access the table box which << get as report does create, you can use << Child on the created display box (it is a border box on highest level)
Names Default To Here(1); dt = open("$SAMPLE_DATA/Big Class.jmp"); r = dt << Get As Report); tb = r << child; tb << Set Title Font Style("Bold"); img = tb << Get Picture; img << Save Image("$TEMP/pic.png", "png"); Open("$TEMP/pic.png"); Write();
or data table box (this won't support coloring)
Names Default To Here(1); dt = open("$SAMPLE_DATA/Big Class.jmp"); r = Data Table Box(dt); img = r << Get Picture; img << Save Image("$TEMP/pic.png", "png"); Open("$TEMP/pic.png");