cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
jb
jb
Level IV

JSL: Send analysis to journal, and then save PDF

Hello, I've scripted JSL to create a control chart analysis.

 

I'd like to send the analysis to a journal, and then save the journal as a PDF file.

 

Here is the last line of code that isn't working:

  

 jrn << Save PDF( "C:\test.pdf");

 

Any help would be appreciated!

 

 

//!
Names Default To Here(1);
dt = Open( "$SAMPLE_DATA/Quality Control/Diameter.jmp" );
dt << New Column ( "LOT", Character( 1 ), Nominal, Set Values( {
  "A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A",
  "A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A",
  "A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A",
  "A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A",
  "B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B",
  "B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B",
  "B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B",
  "B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B"
  } )
);
cchart = Control Chart( Sample Label(:DAY),Phase(:LOT),Group Size(1),KSigma(3),
  Chart Col( :DIAMETER,
    Individual Measurement(
      Phase Level( "A", LCL( 3.49 ), Avg( 4.36 ), UCL( 5.23 ) ),
      Phase Level( "B", LCL( 3.46 ), Avg( 4.32 ), UCL( 5.18 ) )
    )
  ),
  SendToReport(
    Dispatch(
      {"Individual Measurement of DIAMETER"},
      "IR Chart of IM",FrameBox,
      {Row Legend( MACHINE,Color(1),Color Theme("JMP Default") )}
    )
  ),
  Where( :OPERATOR == "RMM" )
);
jrn = New Window( cchart << Journal );
jrn << Save PDF( "C:\test.pdf");

 

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: JSL: Send analysis to journal, and then save PDF

I don't have the necessary privs to write to the top level of my C drive.  Also there's a flag you can include to prevent the page setup dialog from popping up.  Finally you don't need to put the journal inside a window.  Try this:

 

 

jrn = cchart << Journal;
jrn << Save PDF( "C:\temp\test1.pdf", show page setup(0));

 

View solution in original post

7 REPLIES 7
shoffmeister
Level V

Re: JSL: Send analysis to journal, and then save PDF

2 things:

1. Somehow it would not save the file in "C:" for me.

2. Save PDF works for reports but not for journals, as it seems.

 

This code works for me:

 

 

Names Default To Here(1);
dt = Open( "$SAMPLE_DATA/Quality Control/Diameter.jmp" );
dt << New Column ( "LOT", Character( 1 ), Nominal, Set Values( {
  "A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A",
  "A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A",
  "A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A",
  "A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A",
  "B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B",
  "B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B",
  "B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B",
  "B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B"
  } )
);
cchart = Control Chart( Sample Label(:DAY),Phase(:LOT),Group Size(1),KSigma(3),
  Chart Col( :DIAMETER,
    Individual Measurement(
      Phase Level( "A", LCL( 3.49 ), Avg( 4.36 ), UCL( 5.23 ) ),
      Phase Level( "B", LCL( 3.46 ), Avg( 4.32 ), UCL( 5.18 ) )
    )
  ),
  SendToReport(
    Dispatch(
      {"Individual Measurement of DIAMETER"},
      "IR Chart of IM",FrameBox,
      {Row Legend( MACHINE,Color(1),Color Theme("JMP Default") )}
    )
  ),
  Where( :OPERATOR == "RMM" )
);
 
jrn = cchart << Report;
jrn << Save PDF( "C:\Users\USERNAME\Desktop\test.pdf");

 

jb
jb
Level IV

Re: JSL: Send analysis to journal, and then save PDF

This worked! Thanks.

pmroz
Super User

Re: JSL: Send analysis to journal, and then save PDF

I don't have the necessary privs to write to the top level of my C drive.  Also there's a flag you can include to prevent the page setup dialog from popping up.  Finally you don't need to put the journal inside a window.  Try this:

 

 

jrn = cchart << Journal;
jrn << Save PDF( "C:\temp\test1.pdf", show page setup(0));

 

jb
jb
Level IV

Re: JSL: Send analysis to journal, and then save PDF

This worked! Thanks.

I was even able to save as Landscape, which fixed the Phased Limits presentation

DaveLee
Level IV

Re: JSL: Send analysis to journal, and then save PDF

I had a similar issue saving to a PowerPoint file and finally stumbled across the Save Presentation command.  I run all my analyses and save them to a common journal then execute the following lines.  I define a global variable named ::fid.  Yes, I know the dangers of colliding namespaces but I'm pretty much the only one who codes in JSL at my small company.so I naively carry on in blissful ignorance...

 

 

Current Journal()<< Set Window Title(::fid || "Summary");
 
/* Set the title of the Journal Window */
jrn=Current Journal();
jrn<<Save Presentation( ::PathOut || ::fid ||" RDIO Summary.pptx", PNG);
jrn<<Save HTML( ::PathOut || ::fid ||"  RDIO Summary.htm", PNG);
jrn<<Close Window;
Exit(); // Closes JMP but files are saved in predetermined folders. 

 

 

Just thought I'd share a similar experience.

 

Dave

jb
jb
Level IV

Re: JSL: Send analysis to journal, and then save PDF

Interesting idea, but I wasn't able to get it to work.

How is ::fid used ?  Do I need to declare this global variable somewhere?  Thanks.

DaveLee
Level IV

Re: JSL: Send analysis to journal, and then save PDF

I define ::fid as a global variable in the very beginning of the script.  The same is true for the ::PathOut global variable. To me ::fid is just short for file ID - something I want to call the file name. I supply the file ID and pathname in the opening lines of the script then run a variety of analyses each getting saved to one journal. I end the script by setting a title for the journal, giving it a reference (i.e., jrn) and then finally save it both as a HTML and a PowerPoint.