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
skyzvoir0001
Level III

Fit Group Automate

Im working with this code but somehow on the 9th output, it gets an error. Parameters_1 contains 23 items on it.

 

 

current data table(subs);
for (i = 1, i <= nitems(parameters_1), i++,
    print(i);
  Oneway(
        X( :Recipe ),
        Y( column(subs, parameters_1[i]) ),
                With Control(1),
                Quantiles(1),
                Means and Std Dev(1),
                CDF Plot(1),
                Mean Error Bars(1),
                Std Dev Lines(1),
        SendToReport( Dispatch(  {}, "Fit Group", OutlineBox, {Set Title( "TYPE="||char(type)||"" )} ) )

    );

);

 

The outputs from 1-8 are shown individually. How do I code such that my output is arranged by 2 and save it into a ppt.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Fit Group Automate

Concerning your error on parameter 9....what is the error that is displayed in the log?

Below is a modification to your code that will display all of the outputs in 2 columns.  It also has the code to save the output to PowerPoint.

Current Data Table( subs );

nw = New Window( "Oneways",
	Lineup Box( N Col( 2 ),
		For( i = 1, i <= N Items( parameters_1 ), i++,
			Print( i );
			Oneway(
				X( :Recipe ),
				Y( Column( subs, parameters_1[i] ) ),
				With Control( 1 ),
				Quantiles( 1 ),
				Means and Std Dev( 1 ),
				CDF Plot( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Fit Group",
						OutlineBox,
						{Set Title( "TYPE=" || Char( type ) || "" )}
					)
				)
 
			);, 
 
		)
	)
);
nw << save presentation("$TEMP\reportppnw.pptx");

However, this will not display 2 graphs per page.  By convention, JMP will place each graph on a separate slide.  To handle this, I typically create a journal where pairs of outputs have been copied over as pictures, and then at the end, the journal is saved to a pptx.  For that, something like below might work.

Names Default To Here( 1 );
Current Data Table( subs );

For( i = 1, i <= N Items( parameters_1 ), i = i + 2,
	hlb = H List Box(
		Oneway(
			X( :Recipe ),
			Y( Column( subs, parameters_1[i] ) ),
			With Control( 1 ),
			Quantiles( 1 ),
			Means and Std Dev( 1 ),
			CDF Plot( 1 ),
			Mean Error Bars( 1 ),
			Std Dev Lines( 1 ),
			SendToReport(
				Dispatch(
					{},
					"Fit Group",
					OutlineBox,
					{Set Title( "TYPE=" || Char( type ) || "" )}
				)
			)
 
		),
		Try(
			Oneway(
				X( :Recipe ),
				Y( Column( subs, parameters_1[i + 1] ) ),
				With Control( 1 ),
				Quantiles( 1 ),
				Means and Std Dev( 1 ),
				CDF Plot( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Fit Group",
						OutlineBox,
						{Set Title( "TYPE=" || Char( type ) || "" )}
					)
				)
 
			)
		);
		zippy = hlb << get picture;
		zippy << save presentation( "$TEMP\report.pptx", append );
	)
);

BTW.....I did not completely test the code.  Therefore, there might be a slight issue or two, but the concepts are correct.

Jim

View solution in original post

5 REPLIES 5
skyzvoir0001
Level III

Re: Fit Group Automate

update: fixed the output part- it now outputs from 1-23, my problem is how do i append it to ppt arranged in 2 or 3 plots per slide?

txnelson
Super User

Re: Fit Group Automate

Concerning your error on parameter 9....what is the error that is displayed in the log?

Below is a modification to your code that will display all of the outputs in 2 columns.  It also has the code to save the output to PowerPoint.

Current Data Table( subs );

nw = New Window( "Oneways",
	Lineup Box( N Col( 2 ),
		For( i = 1, i <= N Items( parameters_1 ), i++,
			Print( i );
			Oneway(
				X( :Recipe ),
				Y( Column( subs, parameters_1[i] ) ),
				With Control( 1 ),
				Quantiles( 1 ),
				Means and Std Dev( 1 ),
				CDF Plot( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Fit Group",
						OutlineBox,
						{Set Title( "TYPE=" || Char( type ) || "" )}
					)
				)
 
			);, 
 
		)
	)
);
nw << save presentation("$TEMP\reportppnw.pptx");

However, this will not display 2 graphs per page.  By convention, JMP will place each graph on a separate slide.  To handle this, I typically create a journal where pairs of outputs have been copied over as pictures, and then at the end, the journal is saved to a pptx.  For that, something like below might work.

Names Default To Here( 1 );
Current Data Table( subs );

For( i = 1, i <= N Items( parameters_1 ), i = i + 2,
	hlb = H List Box(
		Oneway(
			X( :Recipe ),
			Y( Column( subs, parameters_1[i] ) ),
			With Control( 1 ),
			Quantiles( 1 ),
			Means and Std Dev( 1 ),
			CDF Plot( 1 ),
			Mean Error Bars( 1 ),
			Std Dev Lines( 1 ),
			SendToReport(
				Dispatch(
					{},
					"Fit Group",
					OutlineBox,
					{Set Title( "TYPE=" || Char( type ) || "" )}
				)
			)
 
		),
		Try(
			Oneway(
				X( :Recipe ),
				Y( Column( subs, parameters_1[i + 1] ) ),
				With Control( 1 ),
				Quantiles( 1 ),
				Means and Std Dev( 1 ),
				CDF Plot( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Fit Group",
						OutlineBox,
						{Set Title( "TYPE=" || Char( type ) || "" )}
					)
				)
 
			)
		);
		zippy = hlb << get picture;
		zippy << save presentation( "$TEMP\report.pptx", append );
	)
);

BTW.....I did not completely test the code.  Therefore, there might be a slight issue or two, but the concepts are correct.

Jim
skyzvoir0001
Level III

Re: Fit Group Automate

thanks for this!
skyzvoir0001
Level III

Re: Fit Group Automate

 

Fit Group(
	For( i = 1, i <= N Items( parameters_1 ), i = i + 2,
		hlb = H List Box(
			Oneway(
				X( :Recipe ),
				Y( Try( Column( subs, parameters_1[i] ) ) ),
				With Control( 1 ),
				Quantiles( 1 ),
				Means and Std Dev( 1 ),
				CDF Plot( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 )

			),
			Try(
				Oneway(
					X( :Recipe ),
					Y( Column( subs, parameters_1[i + 1] ) ),
					With Control( 1 ),
					Quantiles( 1 ),
					Means and Std Dev( 1 ),
					CDF Plot( 1 ),
					Mean Error Bars( 1 ),
					Std Dev Lines( 1 )
				)
			);
			zippy = hlb << get picture;
		)
	)
);

 

I tried the code you gave but somehow this gives me an error:

Not Found in access or evaluation of 'Oneway' , Bad Argument(
{Try( Column( subs_top, parameters_1[i] ) ), Role requires at least 1 columns.}
), Oneway(/*###*/X( :Recipe ),
Y( Try( Column( subs_top, parameters_1[i] ) ) ),
With Control( 1 ),
Quantiles( 1 ),
Means and Std Dev( 1 ),
CDF Plot( 1 ),
Mean Error Bars( 1 ),
Std Dev Lines( 1 )
)

Fit Group[]

skyzvoir0001
Level III

Re: Fit Group Automate

but when trying the code i came up earlier,

Current Data Table( subs );
t0p = Fit Group(
	For( i = 1, i <= N Items( parameters_1 ), i++,
		Oneway(
			X( Column( subs, "Recipe" ) ),
			Y( Try( Column( subs, parameters_1[i] ) ) ),
			With Control( 1 ),
			Quantiles( 1 ),
			Means and Std Dev( 1 ),
			CDF Plot( 1 ),
			Mean Error Bars( 1 ),
			Std Dev Lines( 1 )
		)
	),
	SendToReport( Dispatch( {}, "Fit Group", OutlineBox, {Set Title( "TYPE=" || Char( type ) || "" )} ) )
) << {Arrange in Rows( 2 )};


works but it does it individually.