Choose Language Hide Translation Bar
Highlighted
nanotub3s
Level I

Saved Journal in HTML only has last graph

Hello, not very good with programming but slowing moving along with stuff I can google and stuff. but no matter what I try to do, the 

Current Journal () << Save PDF(blah blah) 

only saves the very last plot. Even though if I comment out the line above and only have

biv << Journal

the script would output Journal with 2 plots. Not sure how I can get the PDF to save both plots?

The parent code...

 

Data Table( "Daily Pull" ) << Join(
	With( Data Table( "Key" ) ),
	By Matching Columns( :Name( "Hello" ) = :Name( "Hello" ) ),
	Drop multiples( 0, 0 ),
	Include Nonmatches( 0, 0 ),
	Preserve main table order( 1 )
);
biv = Bivariate(
	SendToByGroup( {:Recipe == "Pizza"} ),
	Y( :VALUE ),
	X( :PROCESS_DATE ),
	By( :Recipe ),
	SendToByGroup(
		{:Recipe == "Pizza"},
		SendToReport(
			Dispatch(
				{"Bivariate Fit of VALUE By PROCESS_DATE Recipe=Pizza"},
				"2",
				ScaleBox,
				{Min( 150 ), Max( 210 ), Inc( 5 ), Minor Ticks( 0 )}
			),
			Dispatch(
				{"Bivariate Fit of VALUE By PROCESS_DATE Recipe=Pizza"},
				"Bivar Plot",
				FrameBox,
				{Row Legend(
					:ENTITY,
					Color( 1 ),
					Color Theme( "JMP Default" ),
					Marker( 1 ),
					Marker Theme( "Standard" ),
					Continuous Scale( 0 ),
					Reverse Scale( 0 ),
					Excluded Rows( 0 )
				)}
			)
		)
	),
	SendToByGroup(
		{:Recipe == "Rice"},
		SendToReport(
			Dispatch(
				{"Bivariate Fit of VALUE By PROCESS_DATE Recipe=Rice"},
				"2",
				ScaleBox,
				{Min( 200 ), Max( 260 ), Inc( 5 ), Minor Ticks( 0 )}
			),
			Dispatch(
				{"Bivariate Fit of VALUE By PROCESS_DATE Recipe=Rice"},
				"Bivar Plot",
				FrameBox,
				{Row Legend(
					ENTITY,
					Color( 1 ),
					Color Theme( "JMP Default" ),
					Marker( 1 ),
					Marker Theme( "Standard" ),
					Continuous Scale( 0 ),
					Reverse Scale( 0 ),
					Excluded Rows( 0 )
				)}
			)
		)
	)
);
jrn = biv << Journal jrn << SavePDF( "$DOCUMENTS\test.pdf" );
1 REPLY 1
Highlighted

Re: Saved Journal in HTML only has last graph

I think there is a missing semicolon on the last line:

 

jrn = biv << Journal; jrn << SavePDF( "$DOCUMENTS\test.pdf" );

Even with this semicolon, the script does not do what you expect.  The issue is that the return value of (biv<<Journal) is the Bivariate report.  This allows for chaining of the commands sent to the platform.  Also note that the value of biv is not a single object, it will be a list with one object for each level of the by-variable:

 

{Bivariate[], Bivariate[]}

So the <<SavePDF() command is sent to each object in the list, and as a result you only see the last report in the PDF file.  You suggest the use of Current Journal(), but the full script below was not using it.  This does work for me:

 

biv << Journal; Current Journal() << SavePDF( "$DOCUMENTS\test.pdf" );

If you prefer to save the PDF directly from the report instead of creating a journal, you can do something like:

 

(biv[1]<<TopParent) << SavePDF("$DOCUMENTS/test.pdf");

This does assume that biv is a list, which will not be the case if you ever run the script on data with only a single level of the by-variable.  If you need to handle both cases, you might use something like:

 

If (IsList(biv),rpt=(biv[1]<<TopParent),rpt=biv<<Report);
rpt << SavePDF("$DOCUMENTS/test.pdf");
Article Labels

    There are no labels assigned to this post.