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
cravin187
Level II

printing something from graph builder stepping through a column switcher all to one PDF?

I have a graph (built in graph builder) with a local data filter that I use a column swticher to see the same graph for multiple columns of data.  The people I built this for want to print all the graphs to a single PDF.  I am at a loss.  I tried the Multi-Column PDF Export - JMP User Community that works for everyting BUT graph builder for some reason.

 

I am no good at JSL....

 

thanks

8 REPLIES 8
jthi
Super User

Re: printing something from graph builder stepping through a column switcher all to one PDF?

What does "print all the graphs to a single PDF" mean in this case? Do they want to print all possible combinations that local data filter and column switcher can produce? Depending on how many values users can change, the amount of choices (and graphs) will quickly get quite massive.

-Jarmo
cravin187
Level II

Re: printing something from graph builder stepping through a column switcher all to one PDF?

If it's 10 columns of data in the switcher, they want all ten of those graphs printed to one document.  The filter is just to show lots that have been on stability out of a larger population.  Sorry for the lack of clarity!

SDF1
Super User

Re: printing something from graph builder stepping through a column switcher all to one PDF?

Hi @cravin187 ,

 

  Thanks for including the add-in with your question. Actually, I think the add-in works, you just don't need to use the column switcher. To a certain extent, the add-in kind of acts like a column switcher as it saves all the graphs to a PDF. Now, one thing I have noticed is that the add-in does include multiple graphs on a PDF, not a single graph per PDF when using it on graph builder, but this also depends on how large you make the graphs. The bigger they are, the fewer can be fit on one PDF page.

 

  But, if you download the add-in, JMP data table, and follow the instructions that the author describes, you will get the same output. Here are two that I made using the graph builder platform. The first one is with the standard GB size, and the second one is with a larger resized GB.

 

Hope this helps!,

DS

cravin187
Level II

Re: printing something from graph builder stepping through a column switcher all to one PDF?

interesting.... when I try it with or with out the local data filter I get:

 

cravin187_0-1700249139649.png

 

SDF1
Super User

Re: printing something from graph builder stepping through a column switcher all to one PDF?

Hi @cravin187 ,

 

  Try it without the Column Switcher.

SDF1_1-1700249925506.pngSDF1_2-1700249939551.pngSDF1_3-1700249990095.pngSDF1_4-1700250033535.png

 

  When I do it like this, I get the attached report.pdf. Works just fine.

 

DS

cravin187
Level II

Re: printing something from graph builder stepping through a column switcher all to one PDF?

however If I make the graph fresh again instead of using the script for making it saved to the table it does work, even with the filter.

so seems I have a solution!

 

jthi
Super User

Re: printing something from graph builder stepping through a column switcher all to one PDF?

I quickly looked at the add-in code and what it basically does: it creates a copy of your report, adds column switcher with your chosen columns and loops over them while adding those to a journal window which will be converted to a pdf. There is one place where it can break fairly easily (thisSO = (cr[Outline Box(1)] << getScriptableObject) << Redo Analysis;) if you have multiple outline boxes in your report window (column switcher and local data filter do create outline boxes) and most likely this is happening when you have a local data filter inside your report.

-Jarmo
jthi
Super User

Re: printing something from graph builder stepping through a column switcher all to one PDF?

I did post other findings regarding behavior of column switcher in some of the platforms to the original add-in discussion. Here is the script I did add there, which attempts to tackle some of the issues, but I haven't really tested it

Names Default To Here(1);

report_windows = Get Window List(Type("Reports")) << Get Window Title();
If(N Items(report_windows) == 0,
	Throw("No report windows open");
);

nw = New Window("Select a Report", <<Modal, << return result,
	hb = H List Box(
		Panel Box("Select a report window",
			lb = List Box(report_windows, Max Selected(1))
		), 
		Panel Box("Actions",
			Lineup Box(N Col(1),
				Button Box("OK"),
				Button Box("Cancel")
			)
		)
	)
);

If(nw["Button"] != 1,
	stop();
);

selected_window = Window(nw["lb"][1]);
obs_platform = (selected_window << XPath("//OutlineBox[@helpKey]"));

report = Empty();

For Each({ob_platform}, obs_platform << Get Scriptable Object,
	// Three checks
	If(Is Scriptable(ob_platform),
		If((ob_platform << window class name) == "Report",
			report = ob_platform;
		);
	)
);

If(IsEmpty(report),
	Throw("No report found from report window");
);

dt = report << Get Data Table();

nw = New Window("Col Selections", << modal, << return result,
	H List Box(
		Panel Box("Select Colums",
			fcs = Filter Col Selector(Datatable(dt))
		),
		Panel Box("Cast Columns",
			Lineup Box(N Col(2),
				Button Box("Y", << Set Function(function({this}, (this << sib) << append(fcs << get selected)))),
				clb = Col List Box(Datatable(dt), Min Items(1))
			)
		),
		Panel Box("Actions",
			Lineup Box(N Col(1),
				Button Box("OK",
					cols = clb << get items;
				),
				Button Box("Cancel")
			)
		)
		
	)
);

If(nw["Button"] != 1,
	stop();
);

If(N Items(cols) < 1,
	Throw("No columns selected"); // Should be moved to validator
);

save_path = Pick Directory("Select a directory");

new_report = report << Redo Analysis;
new_report << Show Window(0);

yexpr = Eval(EvalExpr(
	Extract Expr(Expr(new_report << get script), Y(Wild())
)));
If(Is Empty(yexpr),
	yexpr = Eval(EvalExpr(
		Extract Expr(Expr(new_report << get script), Column(Wild())
	)));	
);
ycol = Arg(yexpr, 1);
ycolname = ycol << get name;

wait(0);
col_switcher = new_report << Column Switcher(ycolname, cols);

ncols = Length(col_switcher << Get List);

jrn = New Window("Reports", << Journal);

For(i = 1, i <= ncols, i++,
	newrep = new_report << Report;
	newrep << Show Window(0);
	jrn << Append(newrep);
	col_switcher << Next;
);

new_report << Remove Column Switcher;
jrn << Set page setup(margins(0.5, 0.5, 0.5, 0.5), scale(.7), portrait(0), paper size("Letter"));
jrn << save pdf(save_path || (selected_window << get window title) || "_report.pdf", Portrait(0));
jrn << Close Window;
new_report << Close Window;

wait(0);

Open(save_path);
Write();
-Jarmo