Subscribe Bookmark RSS Feed

Scripting a Report

jake

Community Trekker

Joined:

Aug 29, 2012

I am trying to script a report that can be run on a weekly basis showing yields.  I have been able to make all my charts I need, I just want to organize them so they are all on one page and save it as a .pdf so I can send it to non-jmp users to read.  I can do what I am trying to do manually by creating a journal and organizing the charts how I want them and saving the journal as a .pdf, but I can't find a way to script it.  Any ideas?ri

11 REPLIES
ms

Super User

Joined:

Jun 23, 2011

I think it would be easier to arrange all charts in a window by script before journaling. Either put the desired displayboxes in horizontal and vertical listboxes to get tha arrangement you wish, or use the predefined Sheetbox() or SheedtPanelBox() for holding your charts. There are good examples in the Scripting Index (help menu).

jake

Community Trekker

Joined:

Aug 29, 2012

Thanks.  That is what I was looking for.  How do I make it into a PDF using the script?

ms

Super User

Joined:

Jun 23, 2011

Assign a variable to the report window holding your chart collection, like nw = New Window(.....).

Then this should work In JMP 10 (I only tested it on a Mac).

nw << save pdf("path/sheetbox.pdf");

Hence no need to Journal. The PDF is created in the directory relative to the default directory. The path may look different in Windows.

jake

Community Trekker

Joined:

Aug 29, 2012

So with "path/sheetbox.pdf", "path" is where I want to save it and "sheetbox" is the name of the file it will save?  So I could make it "Desktop/MyChart.pdf"?

ms

Super User

Joined:

Jun 23, 2011

Try run the command get default directory() and  look in the log for the path, typically your documents folder. The path you specify in Save PDF() should be hierarchically beneath the default directory path. At least that's  how it works on JMP 10 for Mac.

Save PDF("test.pdf") creates the text.pdf file in my documents folder.

Save PDF("output/test.pdf") creates the file in a folder named output within my documents folder.

To save to the desktop you may have to first change the default directory.

jake

Community Trekker

Joined:

Aug 29, 2012

It doesn't appear I have a default directory.  I run get default directory()  and it shows nothing.  When I run get current directory()  I get something.  Any idea on how to set that up?

jake

Community Trekker

Joined:

Aug 29, 2012

I just figured out that you can run set the directory().  Just type in the directory with quotes in the ().

Thanks for all your help.  I think I am good to go.  Although I am unsure how to say this question is answered.

jake

Community Trekker

Joined:

Aug 29, 2012

Actually, one last question.  How do I include a variable in the name of the file so I can create a new file every day I run the script (for example 08_31_12Sheetbox.pdf)?

ms

Super User

Joined:

Jun 23, 2011

Use concatenation of strings with the || operator

An example:


tag = char(shortdate(today()));

nw << save pdf("optionalpath/"||tag||"sheetbox.pdf");