cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
senatorx
Level III

Combine multiple journals into one journal

iHi, I'd like to do something similar to below. I'm running JMP9.

Trend_rpt = trend_biv1 << Report; //trend_biv1 is a bivariate object.

Trend_rpt << Save Journal(SavePath || "journal1.jrn");

Trend_rpt = trend_biv2 << Report; //trend_biv2 is a second bivariate object.

Trend_rpt << Save Journal(SavePath || "journal2.jrn");

//Later in script, after the report and bivariate objects no longer exist:

ob1_jrn = Open(SavePath || "journal1.jrn");

ob2_jrn = Open(SavePath || "journal2.jrn");

ob1_jrn << Append(ob2_jrn); //doesn't work.

ob1_jrn << Save Journal(SavePath || "combinedJournal.jrn");

I would like some method to combine journal output into a single journal.

Alternatively, I would like a way to open multiple .PNG files and add them to a single journal.  As far as I can tell, there is no way to add an image file to a journal.  Any thoughts?  Thanks!

5 REPLIES 5
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Combine multiple journals into one journal

Only display boxes can be appended. An index (or name) can be used to address a display box within the journal object.

This should work:

ob1_jrn <<  append(ob2_jrn[1]);


Or alternatively, to get more layout options the content of both journals can be combined in a new window, e.g.:

nw = new window( "Biv1&2", hlistbox( ob1_jrn[1], ob2_jrn[1] ) );

nw << Save Journal(SavePath || "combinedJournal.jrn");


gzm
gzm
Level III

Re: Combine multiple journals into one journal

//The code below uses Journal Box() and Picture Box() to create a custom display of saved journals and pictures.

//Note you can use a statement like jrn_src = trend_cc1 << get journal, even when trend_cc1 is invisible

//before saving them.

 

SavePath = "c:\temp\";

dt = open("$sample_data\semiconductor capability.jmp");

dt:lot_id << Set Property(

                "Value Ordering",

                {"lot1", "lot2", "lot3", "lot4", "lot5", "lot6", "lot7", "lot8", "lot9",

                "lot10", "lot11", "lot12", "lot13"}

           );

dt << Color by Column(:lot_id);

// create trend charts

trend_cc1 = Control Chart(

     Phase( :lot_id ),

     KSigma( 3 ),

     Show Limits Legend( 0 ),

     Chart Col(

           :NPN1,

           Levey Jennings(

                Test 1( 1 )

           )

     ),

     SendToReport(

           Dispatch(

                {"Levey Jennings of NPN1"},

                "1",

                ScaleBox,

                {Format( "Best", 10 ), Min( 0.5 ), Max( 1456 ), Inc( 100 ),

                Minor Ticks( 0 )}

           ),

           Dispatch(

                {"Levey Jennings of NPN1"},

                "Levey Jennings Chart",

                FrameBox,

                {Frame Size( 546, 182 )}

           )

     )

);

trend_cc2 = Control Chart(

     Phase( :lot_id ),

     KSigma( 3 ),

     Show Limits Legend( 0 ),

     Chart Col(

           :PNP1,

           Levey Jennings(

                Test 1( 1 )

           )

     ),

     SendToReport(

           Dispatch(

                {"Levey Jennings of PNP1"},

                "1",

                ScaleBox,

                {Format( "Best", 10 ), Min( 0.5 ), Max( 1456 ), Inc( 100 ),

                Minor Ticks( 0 )}

           ),

           Dispatch(

                {"Levey Jennings of PNP1"},

                "Levey Jennings Chart",

                FrameBox,

                {Frame Size( 546, 182 )}

           )

     )

);

Trend_rpt = trend_cc1 << Report; //trend_cc1 is a control chart object.

Trend_rpt << Save Journal(SavePath || "journal1.jrn");

trend_cc1<< Close Window;

Trend_rpt = trend_cc2 << Report; //trend_cc2 is a second control chart object.

Trend_rpt << Save Journal(SavePath || "journal2.jrn");

trend_cc2 << Close Window;

//Later in script, after the report and bivariate (or control chart) objects no longer exist:

//JMP Example from Functions >> Display >> Picture Box()

pict = If( Host is( Windows ),

     Open(

           "$JMP_HOME/Support Files English/Tip of the Day/images/tip8-1.gif",

           png

     )

);

// you can read the JRN file as text or as a journal

//If you read as a journal file you will also have 2 journal

//windows open, you can open them invisible

ob1_jrn_txt = Load Text File (SavePath || "journal1.jrn", Invisible);

ob2_jrn_txt = Load Text File(SavePath || "journal2.jrn", Invisible);

nw = New Window( "Example",

ob = OutlineBox("lay 'em out & stack 'em up",

  HListBox(

     Picture Box( pict ),

     VlistBox(Journal Box(ob1_jrn_txt), JournalBox(ob2_jrn_txt)

))));

ob1_jrn = Open (SavePath || "journal1.jrn");

ob2_jrn = Open(SavePath || "journal2.jrn");

ob1_jrn_src = ob1_jrn << get journal;

ob2_jrn_src = ob2_jrn << get journal;

//now close journal window objects

ob1_jrn << close window;

ob2_jrn << close window;

ob << append( HlistBox(Journal Box(ob1_jrn_src), JournalBox(ob2_jrn_src)

));

Yngeinstn
Level IV

Re: Combine multiple journals into one journal

I know this in old thread and this code works great. However my question how would you approach it when you already have journals open that were generated from a report?

 

Do you still have to save it then bring it back in or can you just apply it to the outline box? Shot out to Mr. TxNelson for helping with to looping with the function

 

 

dt = Current Data Table();

doGraphPlot = Function( 
		
	{dt, Xaxis, Yaxis, Grby, chnl}, 
	
	Eval(
		Substitute(
				Expr(
					gb = dt << Graph Builder(
						invisible,
						where( dt:channel == chnl ),
						size( 600, 400 ),
						show control panel( 0 ),
						show legend( 0 ),
						variables(
							Y( Eval( Yaxis ) ),
							X( Eval( Xaxis ) ),
							Group X( Eval( Xgrby ) ),
							Overlay( :RowCol )
						),
						elements( smoother( X, Y, legend( 19 ), lambda( 0.0001 ) ) )
					)
				),
			Expr( chnl ), chnl,
			Expr( mode ), mode,
			Expr( wafer ), wafer
		)
	);
	
	(gb << top Report)[TextBox(1)] << delete;  //delete the where statemen
	
	Report( gb )[Outline Box( 1 )] << set title( char(wafer) || " [" || char( mode ) || "] Channel = " || char( chnl ) );
	
);

// close( dtsum, no save );

dtsum = dt 
	<< Summary(
		Group( 
			:channel,
			:trmode,
			:wafer_number
		), 
		invisible ); //

jjrn1 = New Window( "Data Plot - Output1 vs Input", << Journal );

Yaxis = Expr(
	Column( dt, "Output1" )
);

Xaxis = Expr(
	 Column( dt, "Input" ) 
);

Xgrby = Expr(
	Column( dt, "wafer_number" )
);

For( i = 1, i <= N Row( dtsum ), i++,
	chnl = dtsum:channel[i];
	mode = dtsum:trmode[i];
	wafer = dtsum:wafer_number[i];

	doGraphPlot( dt, Yaxis, Xaxis, Xgrby, chnl );
	
	jjrn1 << append( Report( gb ) );
	gb << close window;

);

jjrn2 = New Window( "Data Plot - Output2 vs Input", << Journal );

Yaxis = Expr(
	Column( dt, "Output2" )
);

Xaxis = Expr(
	Column( dt, "Input" ) 
		
);

Xgrby = Expr(
	Column( dt, "wafer_number" )
);

For( i = 1, i <= N Row( dtsum ), i++,
	chnl = dtsum:channel[i];
	mode = dtsum:trmode[i];

	doGraphPlot( dt, Yaxis, Xaxis, Xgrby, chnl );
	
	jjrn2 << append( Report( gb ) );
	gb << close window;

);

jjrn3 = New Window( "Data Plot - Output3 vs Input", << Journal );

Yaxis = Expr(
	Column( dt, "Output3" )
);

Xaxis = Expr(
	Column( dt, "Input" ) 
		
);

Xgrby = Expr(
	Column( dt, "wafer_number" )
);

For( i = 1, i <= N Row( dtsum ), i++,
	chnl = dtsum:channel[i];
	mode = dtsum:trmode[i];

	doGraphPlot( dt, Yaxis, Xaxis, Xgrby, chnl );
	
	jjrn3 << append( Report( gb ) );
	gb << close window;

);

Close( dtsum, nosave );

SavePath = "c:\temp\";

jjrn1_rpt = jjrn1;
jjrn1_rpt << save journal( SavePath || "journal1.jrn" );
jjrn1 << close window;

jjrn2_rpt = jjrn2;
jjrn2_rpt << save journal( SavePath || "journal2.jrn" );
jjrn2 << close window;

jjrn3_rpt = jjrn3;
jjrn3_rpt << save journal( SavePath || "journal3.jrn" );
jjrn3 << close window;

nw = new window( "Example",
	ob = outline box( "Example1",
		H List Box(
			Journal Box( ob1_jrn_txt ), // This the confusing part
			Journal Box( ob2_jrn_txt ), // This the confusing part
			Journal Box( ob3_jrn_txt ) // This the confusing part
		)
	)
);
txnelson
Super User

Re: Combine multiple journals into one journal

In your code, you seem to have the assumption that variables jjrn1, jjrn2 and jjrn3 are them selfs the journals.  They are not the journals, but rather a pointer to the journals.  So when you have 

jjrn1_rpt = jjrn1;
jjrn1_rpt << save journal( SavePath || "journal1.jrn" );
jjrn1 << close window;

you do not have a new copy of the journal in the variable jjrn1_rpt, you just have a pointer to the journal.  So when you close the journal, neither jjrn1 or jjrn1_rpt have anything to point to.

If you place the code below, prior to your section on saving the jorunals, you will end up with a combined journal.

nw = new window( "Example",journal
	ob = outline box( "Example1",
		hhh = H List Box(
		)
	)
);

hhh << append(jjrn1);
jjrn1 << close window;
hhh << append(jjrn2);
jjrn2 << close window;
hhh << append(jjrn3);
jjrn3 << close window;
Jim
Yngeinstn
Level IV

Re: Combine multiple journals into one journal

Thank you Mr. Nelson


That actually killed two birds with one stone.. I was literally just working on how to solve the problem with the title of outline box of the final journal.

 

Appreciate it